Home Forums Support Connection specific AppendShutdownHandler Reply To: Connection specific AppendShutdownHandler

#3960
Anonymous
Inactive

Thanks for the answer,
What i already do is this:

TCPConnectionListener listener = new TCPConnectionListener(new SendReceiveOptions<ProtobufSerializer, LZMACompressor>(), ApplicationLayerProtocolStatus.Enabled, true);

NetworkComms.AppendGlobalConnectionCloseHandler(ClientDisconnected);
NetworkComms.AppendGlobalConnectionEstablishHandler(ClientConnected);

listener.AppendIncomingPacketHandler<string>("PING", HandleIncomingPINGPacket);
listener.AppendIncomingPacketHandler<string>("DEST", HandleIncomingDESTPacket);
listener.AppendIncomingPacketHandler<byte[]>("DATA", HandleIncomingDATAPacket);

Connection.StartListening(listener, new IPEndPoint(IPAddress.Any, 19000));

Basically I would like to make those ClientConnected and ClientDisconnected related to this listener, instead of make them global.
The reason why is because I got a client in the same application, and when it connects or disconnects It triggers the same methods of this listener.