/// <summary> /// Sends the specified packets data to the client, and releases the resources /// </summary> /// <param name="packet"> the udp packet which will be send</param> /// <param name="message">the string that will be sended to client</param> public void SendAsync(UDPPacket packet, string message) { // If we are shutting down, dont receive again if (!IsRunning) { return; } packet.SetBufferContents(Encoding.UTF8.GetBytes(message)); if (LogWriter.Log.DebugSockets) { LogWriter.Log.Write(LogLevel.Debug, "{0} [Send] UDP data: {1}", ServerName, message); } Listener.SendToAsync(packet.AsyncEventArgs); }
/// <summary> /// Sends the specified packets data to the client, and releases the resources /// </summary> /// <param name="packet">the udp packet which will transfer byte to its own format</param> /// <param name="message">the bytes that will be send to client</param> protected void SendAsync(UDPPacket packet, byte[] message) { // If we are shutting down, dont receive again if (!IsRunning) { return; } packet.SetBufferContents(message); string tempSendMsg = BitConverter.ToString(packet.ByteReply); if (LogWriter.Log.DebugSockets) { LogWriter.Log.Write(LogLevel.Debug, "{0} [Send] UDP data: {1}", ServerName, tempSendMsg); } Listener.SendToAsync(packet.AsyncEventArgs); }