partial void OnCleaningUpPartial() { _logger.Trace("Partial clean up method to shut down UDP receiver"); if (Socket != null) { Socket.DataReceived -= Socket_DataReceived; } if (_udpReceiver != null) { _udpReceiver.DataReceived -= Socket_DataReceived; _udpReceiver.Shutdown(); _udpReceiver = null; } }
protected override void OnClientAccepted(string remoteAddress, int remotePort) { _logger.Trace("Extending base class client accept method"); // at this point, we know the client ip // => create udp socket _udpReceiver = new UdpSocketWrapper(); _udpReceiver.Initialize(LocalEndpoint.Address.ToString(), LocalEndpoint.Port, remoteAddress, remotePort); _udpReceiver.DataReceived += Socket_DataReceived; _udpReceiver.ReceiveFromAsync(); // start receiving Socket.ReceiveAsync(); }