Jump to content
KenR

TWSocket Trap Errors in Service

Recommended Posts

Hi,

 

I have been using TWSocket very successfully for a few years now in a service. It listens for and processes HL7 messages. At one hospital however it seems to hang while it is seemingly not doing anything. I am using a TICSLogger but am not getting any errors. I am presuming this is a socket error. The NHS typically rum a lot of processes on rather underpowered old hardware. Can anyone please point me in the right area as to how I might trap, report and, preferably, have the socket start listening again.

 

Thanks in advance for any help given.

 

Ken

Share this post


Link to post

Server sockets tend to only raise errors when they are processing data, not sitting idle listening. 

 

There are really only two solutions, send wake up data periodically to the server socket, or check a last received time stamp if you expect data every five minutes or something, or perhaps a combination of the two.   

 

Wake up testing can be added with a few lines of code using TSslHttpRest for HTTP or TIcsIpStrmLog for simple ASCII which I believe HL7 uses.  I had a problem with one of my web servers not listening after restart and added this in half an hour.  Then discovered I was incorrectly setting a firewall rule on startup. 

 

If TWSocket has stopped listening, you can try closing and re-opening, but it's safer to restart the application, which is easy with a Windows service, just set service properties to restart after five seconds, and stop it.  My servers send an email when this happens so I know to check the logs for why, the OverbyteIcsDDWebService sample illustrates this. 

 

Angus

 

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×