コード例 #1
0
 /// <summary>
 /// Adds the client to the collection of connected clients.
 /// </summary>
 /// <param name="client"></param>
 public void Add(ClientSession client)
 {
     if( client == null ) throw new ArgumentNullException("client");
     sessions.Add( client );
     client.Opened += new EventHandler(client_Opened);
     client.Closed += new EventHandler(client_Closed);
     client.IncomingMessage += new EventHandler(client_IncomingMessage);
     Console.WriteLine("ClientSession added.");
 }
コード例 #2
0
 /// <summary>
 /// Takes a Network Stream from Server and makes it into a ClientSession object for storage.
 /// </summary>
 /// <param name="clientStream"></param>
 /// <returns></returns>
 public ClientSession Add(NetworkStream clientStream)
 {
     Console.WriteLine("Adding client stream to list");
     ClientSession session = new ClientSession(clientStream, HistoryDump);
     Add(session);
     session.Handler();
     return session;
 }