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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
804 次查看
martinpi
Contributor III

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

标记 (3)
0 项奖励
1 解答
579 次查看
martinpi
Contributor III

has been answered in a different thread. Thanx.

The answer is: use fnet_error_get()

在原帖中查看解决方案

0 项奖励
1 回复
580 次查看
martinpi
Contributor III

has been answered in a different thread. Thanx.

The answer is: use fnet_error_get()

0 项奖励