Re: How to detect a closed TCP/IP connection

Manuel Borchers <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hi William!

Am Mo, den 22.03.2004 schrieb william um 19:37:
> I'm trying to build a tcp server using keil C and DS80c400, but I'm 
> found an weird problem: How to detect a closed connection? I've tried to 
> stay in an "while" loop, calling the "avail" function at each iteration, 

I do this with dummy reading from the input stream (I often have
server-sends-only scenarios, but you should be able to integrate this
into a normal read scenario, too). If read returns <0, the connection
dropped. In that case, I go out of the while loop, close the connection.
done.

I did that in C in a daemon I wrote for my linux system and also did
that today in Java for the TINI.

Cheers,
Manuel

-- 
[email protected]
http://www.matronix.de - http://www.elektronik-kompendium.de/public/borchers

 00:57:26 up 10:12,  1 user,  load average: 0.01, 0.02, 0.00

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.