> *Subject:* Re: [twsocket] Pinging multipe hosts
> *From:* Ertan Küçüko_lu <ertan.kucuko...@1nar.com.tr>
> *To:* "'ICS support mailing'" <twsocket@lists.elists.org>
> *Date:* Sat, 12 Mar 2016 19:34:21 +0200
> I thought, at first, that ping might be a solution. After reading 
> your post, I better find another way to check if client is
> running.  More details about subject:
> - I will be writing both applications that running on server and 
> client.
> - Client will inform server first time it is running thru a 
> webservice.
> - Client will inform server every minute it is running thru a 
> webservice. - If it is more than a minute and client still didn't 
> inform that it is
> running, I would like to know that client is really alive, or 
> busy and couldn't say that it is running.
> - If client is really closed, I will do some database operations 
> on server side.

Look at the sample OverbyteIcsPingTst which illustrates ping using a
thread, so your application is not blocked while testing a host.  

As François says, it's better to test the protocol, in your case by
sending your own defined packets back and forth every minute. This is
very low overhead.  But there is no notification if an open TCP
connection is lost, until you try to send more data when it will fail
after a timeout.  

But beware opening a TCP connection to a host that is offline is a
effectively a blocking operation and will timeout after about 40
seconds preventing any other new connections during that time. That is
when it's better to ping first since it has a controlled timeout of a
few seconds so you get a failed response more quickly. 

I did all this 10 years ago tracking 500 London buses with wifi on
parts of their routes, so connections dropping all the time, but had to
FTP data to and from them when they were online.  All this was
controlled from a SQL database with a web application showing which
buses were online, last contact, and environmental stuff like failed
fans that meant the PC would overheat and die, as dozens did. 


To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to