private Thread wThread; // The local thread

        #endregion Fields

        #region Constructors

        public ClientManager(Socket clsock)
        {
            this.ClientSocket = clsock;
            this.remoteAddress = RemoteAddress.Parse(clsock.RemoteEndPoint.ToString());
            LingerOption lingeroption = new LingerOption(false, 0);
            this.ClientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, (Server.cfg.CTI_CLIENT_KEEPALIVE  * 1000));
            this.ClientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingeroption);
            this.ClientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, (Server.cfg.CTI_CLIENT_TIMEOUT * 1000));

            Server.logger.WriteLine(LogType.Notice, string.Format("ClientManager initialized for {0}",clsock.RemoteEndPoint.ToString()));
        }
Exemple #2
0
 /// <summary>
 /// This event is fired when the server gets stopped... not used yet
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="addr"></param>
 void client_ServerStopped(object sender, RemoteAddress addr)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 public void Dispose()
 {
     // Deduct no. of clients by one
         Interlocked.Decrement(ref Server.shared.NumberOfClients );
         Console.WriteLine("Number of active connections is {0}", Server.shared.NumberOfClients);
         this.wThread = null;
         this.remoteAddress = null;
         this.ClientSocket = null;
         this.networkStream = null;
         // this.sessione = null;
 }