public static void SendData(this Socket socket, IPacketWriter packet, string packetname = "") { byte[] buffer = packet.ReadDataToSend(); try { socket.Send(buffer, 0, buffer.Length, SocketFlags.None); if (!string.IsNullOrEmpty(packetname)) { Log.Message(LogType.DUMP, "SENT {0}.", packetname); } } catch (Exception e) { Log.Message(LogType.ERROR, "{0}", e.Message); } }