LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   problem with client-server (https://www.linuxquestions.org/questions/programming-9/problem-with-client-server-315649/)

himanshu 04-21-2005 07:30 AM

problem with client-server
 
I have implemented client-server programming using TCP sockets.read and write works fine between client and server but when i close client with ctrl-c then server stops with broken pipe.what may be the problem. I have implemented server using select() system call.how can i check client is no more connected and server is still running and again it will wait for client ???

jtshaw 04-21-2005 07:44 AM

Moved to Programming because I think you'll have better luck there.

itsme86 04-21-2005 08:34 AM

When a client disconnects, select() will place that descriptor in the readset. I imagine that after select() returns you loop through the descriptors and read from the ones that are left in the readset. When you read from the descriptor that disconnected, read() will return 0.


All times are GMT -5. The time now is 09:18 AM.