AnsweredAssumed Answered

fnet - socket: How can I detect when the client has disconnected a TCP-connection?

Question asked by martinpi on Apr 20, 2015
Latest reply on Apr 21, 2015 by martinpi

Hi everybody,

 

I am using the fnet-stack.

I create a socket with socket(), bind() and accept().

The Client connects, I use the socket that is returned by accept()

and we both can send and receive.

 

When the Client disconnects, I see a FIN / FIN ACK / ACK sequence in Wireshark,

but how does my application know that the connection is closed (or timed out)?

 

The socket Status returned by getsockopt() is still 2 = SS_CONNECTED,

calls to subsequent sendto() do not yield an error

and the Information is sent as if the connection were still open.


So, how do I detect when the client has disconnected a TCP-connection?

 

Greetings, Martin

Outcomes