kNet icon indicating copy to clipboard operation
kNet copied to clipboard

There is no event raised when a peer half-closes the connection.

Open juj opened this issue 13 years ago • 0 comments

The INetworkServerListener::ClientDisconnected(kNet::MessageConnection* source) callback is signalled when a connection on the server is fully bidirectionally closed.

However, there does not exist a corresponding event that would get signalled when the network peer only half-closes (write-closes) the connection. Therefore to be able to respond to these remote write-closes and to bidirectionally close the connection, one has to poll to detect this.

Add a signal that gets raised when a connection is write-closed from remote end, so that the code path can avoid polling.

As a workaround, one can poll like this:

// Periodically in application main loop if (messageConnection->GetConnectionState() == kNet::ConnectionPeerClosed) messageConnection->Disconnect(); // Peer has write-closed. Write-close from this end as well.

juj avatar Aug 24 '12 11:08 juj