public void Send(Socket socket, ISocketMessage messageBase) { try { if (socket.Connected) { byte[] serialized = messageBase.Serialize(); Socket.BeginSendTo(serialized, 0, serialized.Length, 0, socket.RemoteEndPoint, SendCallback, socket); } } catch (SocketException e) { _logger.Warn(e.Message); } }
public void Send(ISocketMessage socketMessageBase) { try { Socket client = TcpClient.Client; if (!client.Connected) { return; } byte[] serialized = socketMessageBase.Serialize(); client.BeginSend(serialized, 0, serialized.Length, 0, SendMessageCallback, client); } catch (Exception e) { _logger.Warn(e.Message); } }