HTML and CSS Reference
In-Depth Information
public void Dispose()
if (_connection != null)
The WsClientConnection class is very similar to the WsAgentConnection class. Instead of a Dictionary
of associated clients, it has a single reference to the WsAgentConnection object. This represents the agent
that the client is chatting with. The constructor supplies the underlying WsConnection object, the associated
WsAgentConection object, and the ID by which this client is known. This is used to prefix the message that is
forwarded to the agent.
open the WsServer.cs file and add the code shown in bold. This creates the
collections that will store the agent and client objects.
#region Members
// This socket listens for new connections
Socket _listener;
// Configurable port # that is passed in the constructor
int _port;
// List of connections
#endregion Members
public WsServer(int port)
// This is a list of active connections
_unknown=new List<WsConnection>();
_agents=new List<WsAgentConnection>();
_clients=new List<WsClientConnection>();
In the WsServer class, replace the MessageReceived() event handler with the code
shown in Listing 13-10.
Search WWH ::

Custom Search