public void FlushQueuedSendPackets() { if (!socket.Connected) { return; } while (SendPacketQueue.Count > 0) { SubPacket packet = SendPacketQueue.Take(); byte[] packetBytes = packet.GetBytes(); try { socket.Send(packetBytes); } catch (Exception e) { Program.Log.Error("Weird case, socket was d/ced: {0}", e); } } }
public void SendPacket(SubPacket subpacket) { if (isConnected) { byte[] packetBytes = subpacket.GetBytes(); try { zoneServerConnection.Send(packetBytes); } catch (Exception e) { Program.Log.Error("Weird case, socket was d/ced: {0}", e); } } else { if (Connect()) { SendPacket(subpacket); } } }