socket question

Steve Holle sholle at link-comm.com
Wed Dec 1 15:19:07 UTC 2004


I'm using sockets in a telnet type application.  My server starts two 
threads, a read and write, on an "accept."  Up to four pairs of threads, 
sessions, are allowed.  The read thread blocks on a recv/timeout routine 
and the write blocks on an rtems queue, with a timeout of one 
second.  Thanks for your help on that one everyone who responded.

The problem I'm having is closing the write thread when the connection is 
closed from the client.  The read thread closes fine but I'm having trouble 
determining how to detect a closed connection in the write thread.  I would 
prefer that the thread kill itself when the connections closes because 
there can be up to four of them and I'm lazy and don't want to figure out 
which one needs killing inside the read thread.  That seems like 
unnecessary coupling between the read and write threads also.

Is there a way I can determine, on the one second interval provided by the 
rtems queue timeout, if a connection is closed?

Let me know if you want to see the code.

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT  59101
sholle at link-comm.com  




More information about the users mailing list