Behzad Asadi Isfahani
|
Posted: January 14, 2010 09:44 by Behzad Asadi Isfahani
|
|
Hello All; I need to know how can understand when the client is disconnected from the server? Thanks; ************************ Regards Behzad Asadi Isfahani ************************ |
Socket Programming in C
Replies: 2 - Last Post: January 25, 2010 05:52
by: Behzad Asadi Isfahani
by: Behzad Asadi Isfahani
showing 1 - 3 of 3
B. Gian James
|
Posted: January 21, 2010 02:51 by B. Gian James
|
|
Hi Behzad, There are a couple of ways that you can determine that a client is no longer connected to your server. First, any send() or sendto(), recv(), recvfrom() setsockopt(), getsockopt() fcntl() and ioctl() man getsockopt Hope this helps. Regards, -gian |
Behzad Asadi Isfahani
|
Posted: January 25, 2010 05:52 by Behzad Asadi Isfahani
|
|
Dear B. Gian James ************************************ Thanks a lot for your time, first. ************************************ Your info was very good. Did you mean, I have to set O_NONBLOCK for a fd? I'll tried to test your idea but I've had a problem with it, can you give me an example to show how I have to use them,please? You know,functions to send and receive are in block mode and block the program till they can done,I've done it by select() function and gave it a timeout. I'd like to know which way is The Best ? ( setsockopt(),getsockopt(),fcntl(),ioctl() ) or ( select() )? I have a server and 5 clients. When I'm testing return value of accept() I can't accept all clients, but I can accept all clients If I don't test it. I need to keep all accepted client fd's, If I write it into a while() so I can't keep them. Do you have an Idea for keep all accepted clients fd's? +++++++++++++++++ Thanks in advance Best Regard Behzad Asadi Isfahani +++++++++++++++++ |
Replies: 2 - Last Post: January 25, 2010 05:52
by: Behzad Asadi Isfahani
by: Behzad Asadi Isfahani







