Esempio n. 1
0
 internal DccListener(DccClient client, TimeSpan timeout, int port)
 {
     m_client  = client;
     m_timeout = timeout;
     m_Port    = port;
     m_closed  = false;
     m_sock    = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     try
     {
         try
         {
             m_sock.Bind(new IPEndPoint(Util.ExternalAddress, m_Port));
         }
         catch
         {
             m_sock.Bind(new IPEndPoint(Util.LocalHostAddress, m_Port));
         }
         m_sock.Listen(1);
         m_sock.BeginAccept(new AsyncCallback(OnAccept), null);
     }
     catch (Exception ex)
     {
         m_client.Dcc.ListenerFailedNotify(this, ex);
     }
     m_timeoutTimer          = new Timer(m_timeout.TotalMilliseconds);
     m_timeoutTimer.Elapsed += OnTimeout;
     m_timeoutTimer.Start();
 }
Esempio n. 2
0
 internal DccListener(DccClient client, TimeSpan timeout, int port)
 {
     m_client = client;
     m_timeout = timeout;
     m_Port = port;
     m_closed = false;
     m_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     try
     {
         try
         {
             m_sock.Bind(new IPEndPoint(Util.ExternalAddress, m_Port));
         }
         catch
         {
             m_sock.Bind(new IPEndPoint(Util.LocalHostAddress, m_Port));
         }
         m_sock.Listen(1);
         m_sock.BeginAccept(new AsyncCallback(OnAccept), null);
     }
     catch (Exception ex)
     {
         m_client.Dcc.ListenerFailedNotify(this, ex);
     }
     m_timeoutTimer = new Timer(m_timeout.TotalMilliseconds);
     m_timeoutTimer.Elapsed += OnTimeout;
     m_timeoutTimer.Start();
 }