/// <summary> /// Serializes packet and adds to outgoing queue. /// </summary> public void SendPacket(PacketBase packet) { try { lock (_outgoingQueue) { //Log.Write($"Queuing '{packet.Type}' packet with {packet.ToBytes().Length} bytes for destination '{_remoteIP}'"); _outgoingQueue.AddRange(packet.ToBytes()); _writeSignal.Set(); } } catch (Exception ex) { ErrorHandler.LogError(ex); } }