private static void TcpSender(Socket socket) { while (true) { object obj = null; if (Concurrency.Dequeue(_tcpSendQueue, out obj)) { System.Type type = obj.GetType(); _logger.Log(string.Format("TCP sending object of type {0}...", type)); Protocol.Send(socket, obj); _logger.Log(string.Format("...TCP sent object of type {0}", type)); } } }
private static void UdpSender(UdpClient udpClient) { while (true) { object obj = null; if (Concurrency.Dequeue(_udpSendQueue, out obj)) { System.Type type = obj.GetType(); byte[] data = Encoding.Serialize(obj); if (Config.ENABLE_UDP_LOGGING) { _logger.Log(string.Format("UDP sending object of type {0}...", type)); } udpClient.Send(data, data.Length); if (Config.ENABLE_UDP_LOGGING) { _logger.Log(string.Format("...UDP sent object of type {0}", type)); } } } }