You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The handler that is registered on the client connection is not called anymore when the connection is closed and then re-created from scratch.
This is my code to create the client connection (TcpConnection):
private static TcpConnection Connect()
{
var clientConnection = ConnectionFactory.CreateTcpConnection("127.0.0.1", Port, out var connectionResult);
if (connectionResult == ConnectionResult.Connected)
{
clientConnection.RegisterStaticPacketHandler<MyResponsePacket>(OnPacketReceived);
clientConnection.ConnectionClosed += OnConnectionClosed;
return clientConnection;
}
Console.WriteLine("Could not connect.");
return null;
}
After first connection, the response sent by the server is properly received in the OnPacketReceived method. But after closing the connection from the client using clientConnection.Close(CloseReason.ClientClosed), any new TcpConnection created with the code above does not seem to receive anything. The packet handler is not called even though it is re-registered after construction.
I also tried to unregister the handler in the OnConnectionClosed method, but this does not have an effect.
The handler that is registered on the client connection is not called anymore when the connection is closed and then re-created from scratch.
This is my code to create the client connection (
TcpConnection
):After first connection, the response sent by the server is properly received in the
OnPacketReceived
method. But after closing the connection from the client usingclientConnection.Close(CloseReason.ClientClosed)
, any newTcpConnection
created with the code above does not seem to receive anything. The packet handler is not called even though it is re-registered after construction.I also tried to unregister the handler in the
OnConnectionClosed
method, but this does not have an effect.See here for a complete demo project to reproduce the issuse:
https://github.com/till-f/Examples/tree/main/Toemsel.Network
The text was updated successfully, but these errors were encountered: