Esempio n. 1
0
 protected void Init(Socket s, ConnectMgr parentnotify)
 {
     this.Client = s;
     if ((this.Client != null) && (this.Client.Connected == true))
     {
         NetworkStream = new NetworkStream(this.Client);
     }
 }
Esempio n. 2
0
 internal AcceptorManager(ConnectMgr conparent)
 {
     m_ConMgrParent = conparent;
     AcceptCallback = new AsyncCallback(OnAcceptReceived);
 }
Esempio n. 3
0
        public override SocketServer.SocketClient AcceptSocket(System.Net.Sockets.Socket s, SocketServer.ConnectMgr cmgr)
        {
            UniversalVideoSocketClient objNew = new UniversalVideoSocketClient(s, cmgr);

            return(objNew);
        }
Esempio n. 4
0
 public override SocketServer.SocketClient CreateSocket(System.Net.Sockets.Socket s, SocketServer.ConnectMgr cmgr)
 {
     return(new UniversalVideoSocketClient(s, cmgr));
 }
Esempio n. 5
0
 public UniversalVideoSocketClient(System.Net.Sockets.Socket s, SocketServer.ConnectMgr cmgr)
     : base(s, cmgr)
 {
 }
Esempio n. 6
0
 internal AcceptorManager(ConnectMgr conparent)
 {
     m_ConMgrParent = conparent;
     AcceptCallback = new AsyncCallback(OnAcceptReceived);
 }
Esempio n. 7
0
 public SocketClient(Socket s, ConnectMgr parentnotify)
     : this()
 {
     Init(s, parentnotify);
 }
Esempio n. 8
0
 public virtual SocketClient CreateSocket( Socket s, ConnectMgr cmgr )
 {
     s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 128000);
     return new SocketClient( s, cmgr );
 }
Esempio n. 9
0
 public TCPRTPSocketClient(System.Net.Sockets.Socket s, SocketServer.ConnectMgr cmgr)
     : base(s, cmgr)
 {
 }
Esempio n. 10
0
        public override SocketServer.SocketClient AcceptSocket(System.Net.Sockets.Socket s, SocketServer.ConnectMgr cmgr)
        {
            TCPRTPSocketClient objNew = new TCPRTPSocketClient(s, cmgr);

            return(objNew);
        }
Esempio n. 11
0
 public SocketClient(Socket s, ConnectMgr parentnotify)
     : this()
 {
     Init(s, parentnotify);
 }
Esempio n. 12
0
        /// <summary>
        ///  Creates a tcp connection asyncronously.  The client muust call DoAsyncRead on connection completed
        /// </summary>
        /// <param name="ipaddr"></param>
        /// <param name="nport"></param>
        /// <returns></returns>
        public bool ConnectAsync(string ipaddr, int nport)
        {
            UserInitiatedDisconnect = false;
            IPAddress  hostadd = null;
            IPEndPoint EPhost  = null;

            if (ipaddr.Length <= 0)
            {
                return(false);
            }

            if (SOCKStrans.IsFilterActive == true)
            {
                /// Set our proxy remote location just in case we've been activated
                SOCKStrans.RemoteHost = ipaddr;
                SOCKStrans.RemotePort = nport;
                ipaddr = SOCKStrans.SocksHost;
                nport  = SOCKStrans.SocksPort;
            }


            try
            {
                if (ConnectMgr.IsIPAddress(ipaddr) == true)
                {
                    EPhost = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(ipaddr), nport);
                }
                else
                {
                    hostadd = ConnectMgr.Resolve(ipaddr);
                    EPhost  = new IPEndPoint(hostadd, nport);
                }
            }
            catch (SocketException e) /// could not resolve host name
            {
                if (m_Logger != null)
                {
                    m_Logger.LogError(ToString(), MessageImportance.Highest, e.ToString());
                }
                return(false);
            }

            //Creates the Socket for sending data over TCP.
            Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            // Connects to the host using IPEndPoint.
            try
            {
                s.BeginConnect(EPhost, m_AsyncConnect, s);
            }
            catch (SocketException e2)
            {
                if (m_Logger != null)
                {
                    m_Logger.LogError(ToString(), MessageImportance.Highest, e2.ToString());
                }
                return(false);
            }

            return(true);
        }
Esempio n. 13
0
 public virtual SocketClient CreateSocket(Socket s, ConnectMgr cmgr)
 {
     s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 128000);
     return(new SocketClient(s, cmgr));
 }