hi,I am french. netos5 with GH3.5 on NET+50. It is on Ethernet. I have four threads. thread1 : do often send(); thread2 : do often send(); thread3 : do recieve(); thread4 : détect a connection probleme… When a connection probleme appear, thread1 and 2 are suspend on send(). Thread4 detect the probleme, and it do CloseSocket();. But after CloseSocket(), the function send() of the thread1 and 2 don’t return immediatly,and they continue to send frame with one octet of data. WHY send()don’t return immediatly and continue to send frame? I have seen that with the software Sniffer PRO. If you want i can give the capture in sniffer pro.(file x.cap). It is important for my job…
It could be that the keep alive packets got sent out at that time. Without looking at the trace, it would be hard to comment about it. However I do suggest others to the following in terms of checking whether the connection associated with a socket is still up without doing a blocking operation and without removing data from the input queue: Use select() the socket for reading first.* If the socket is not readable, the connection is still up. In case the socket is readable, I call recv() with the MSG_PEEK flag set (in order to not remove data from the input queue). * If the return value is positive, the connection is still up. * If the return value is 0, the peer closed the connection gracefully. * If the return value is negative and getErrno() returns ENOTCONN, the peer did a hard close.
ok,I have understood your answer. I didn’t have the option keep alive and so_linger and it is a sock_stream. I read a leason about socket, and i read that is normal that the socket continue send the buffer output after a closesocket(); But, how can i do for stop the send buffer to continue to send?