Пример #1
0
        public override void Close()
        {
            if (this.m_OpenState == soteSFIS2Fxcn.OpenStates.Stopped)
            {
                return;
            }
            lock (this)
            {
                switch (this.m_OpenState)
                {
                case soteSFIS2Fxcn.OpenStates.Listening:
                    this.m_Listener.Stop();
                    break;

                case soteSFIS2Fxcn.OpenStates.Connected:
                    this.m_ClientStream.Close();
                    this.m_ClientStream = (NetworkStream)null;
                    this.m_Client.Close();
                    this.m_Client         = (TcpClient)null;
                    this.m_RemoteEndPoint = (EndPoint)null;
                    this.m_Timer.Change(-1, 3000);
                    break;
                }
                this.m_OpenState = soteSFIS2Fxcn.OpenStates.Stopped;
            }
            base.Close();
        }
Пример #2
0
 private void HandleSocketFailure(Exception ex1, ref List <Exception> exceptionList)
 {
     if (exceptionList == null)
     {
         exceptionList = new List <Exception>();
     }
     if (ex1 != null)
     {
         exceptionList.Add(ex1);
     }
     if (this.m_ClientStream != null)
     {
         this.m_ClientStream.Close();
         this.m_ClientStream = (NetworkStream)null;
     }
     if (this.m_Client != null)
     {
         this.m_Client.Close();
         this.m_Client = (TcpClient)null;
     }
     this.m_RemoteEndPoint = (EndPoint)null;
     this.m_Timer.Change(-1, 3000);
     this.m_OpenState = soteSFIS2Fxcn.OpenStates.Stopped;
     try
     {
         this.m_Listener.Start();
         this.m_Listener.BeginAcceptTcpClient(new AsyncCallback(soteSFIS2Fxcn.OnAcceptTcpClient), (object)this);
         this.m_OpenState = soteSFIS2Fxcn.OpenStates.Listening;
     }
     catch (Exception ex)
     {
         exceptionList.Add(ex);
     }
 }
Пример #3
0
 public override void Open()
 {
     lock (this)
     {
         if (this.m_OperatorId == null)
         {
             throw new ArgumentNullException("Property \"OperatorId\" must be set properly.");
         }
         if (this.m_OpenState != soteSFIS2Fxcn.OpenStates.Stopped)
         {
             return;
         }
         if (this.m_Listener == null)
         {
             this.m_Listener = new TcpListener(IPAddress.Any, this.m_Port);
         }
         this.m_Listener.Start();
         this.m_Listener.BeginAcceptTcpClient(new AsyncCallback(soteSFIS2Fxcn.OnAcceptTcpClient), (object)this);
         this.m_OpenState = soteSFIS2Fxcn.OpenStates.Listening;
     }
     base.Open();
 }