private void ReceiveThread() { try { byte[] buffer = new byte[4]; while (_processReceiveThread) { if (!Receive(buffer)) { break; } byte[] packet = new byte[IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buffer, 0))]; if (!Receive(packet)) { break; } IrssMessage message = IrssMessage.FromBytes(packet); MessageManagerCombo combo = new MessageManagerCombo(message, this); if (_messageSink != null) { _messageSink(combo); } } } #if TRACE catch (SocketException socketException) { Trace.WriteLine(socketException.ToString()); } #else catch (SocketException) { } #endif finally { if (_connection != null) { _connection.Close(100); _connection = null; } _disconnectCallback(this); } }
private void QueueMessageSink(MessageManagerCombo combo) { _messageSink(combo); }
private void ClientManagerMessageSink(MessageManagerCombo combo) { _messageQueue.Enqueue(combo); }