/// <summary> /// Send data /// </summary> /// <param name="bytes"></param> public static void Send(byte[] bytes) { if (_tcpConnection != null) { _tcpConnection.Send(bytes); } }
private void OnMessageArrived(ITcpConnection connection, byte[] message) { try { _messageArrivedHandler(connection, message, reply => connection.Send(reply)); } catch (Exception ex) { _logger.Error("Handle message error.", ex); } }
public void Send(IMessage message) { _connectFinalized.WaitOne(); var byteData = Encoding.ASCII.GetBytes(message.SerializeToXml() + Constants.EtbByte); try { _tcpConnection.Send(byteData); } catch (Exception e) { ConnectionError.PrintUnexpectedConnectionErrorDetails(e); throw; } }