Esempio n. 1
0
 /// <summary>
 /// Send data
 /// </summary>
 /// <param name="bytes"></param>
 public static void Send(byte[] bytes)
 {
     if (_tcpConnection != null)
     {
         _tcpConnection.Send(bytes);
     }
 }
Esempio n. 2
0
 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;
            }
        }
Esempio n. 4
0
 private void OnMessageArrived(ITcpConnection connection, byte[] message)
 {
     try
     {
         _messageArrivedHandler(connection, message, reply => connection.Send(reply));
     }
     catch (Exception ex)
     {
         _logger.Error("Handle message error.", ex);
     }
 }