public override bool Equals(object obj) { WhoSender whoObj = obj as WhoSender; if (whoObj != null) { return(sender.Equals(whoObj.sender)); } return(base.Equals(obj)); }
protected override void ReadSocket() { try { while (IsStarted()) { IPEndPoint senderEndPoint = remoteIpEndPoint; byte[] receiveBytes = null; if (readQueue != null) { UdpPacket packet = readQueue.Take(); senderEndPoint = packet.IPEndPoint; receiveBytes = packet.Bytes; } else { receiveBytes = udpClient.Receive(ref senderEndPoint); } WhoSender sender = new WhoSender(senderEndPoint); FlexBuffer receiveBuf = new FlexBuffer(receiveBytes); session.SessionPacket(sender, receiveBuf); } } catch (ArgumentNullException) { // ignore } catch (SocketException ex) { if (ex.SocketErrorCode != SocketError.Interrupted) { throw ex; } } }