/// <summary> /// Constructor for ClientConnection /// </summary> /// <param name="id">ClientID is an id representing this connection</param> /// <param name="connection">This is a TCPConnection representing the connection to the client</param> /// <param name="MessageReceived">This is a delegate representing the method to be called when a message is received</param> /// <param name="ConnectionFailed">This is a delegate representing the method to be called when the connection fails</param> /// <param name="MessageFailed">This is a delegate representing the method to be called when a corrupt message is received</param> public ClientConnection(TCPConnection connection) { this.buffer = new Buffer<AbstractMessage>(); this.connection = connection; ClientID = new ClientID(); terminating = false; hasStarted = false; writer = new MessageWriter(this, connection); reader = new MessageReader(this, connection); }
/// <summary> /// Constructor for MessageWriter. /// </summary> /// <param name="inner">This is the ClientConnection that this class is inside.</param> /// <param name="connection">This is the TCPConnection that the ClientConnection is connected to.</param> /// <param name="MessageFailed">A delegate representing the method to be called whenever this MessageWriter /// fails to write a message into it's underlying TCPConnection.</param> public MessageWriter(ClientConnection inner, TCPConnection connection) { this.inner = inner; this.connection = connection; }