Ejemplo n.º 1
0
        public override void handle_connect(AsyncConnect ar)
        {
            Socket          sock = (Socket)ar.handle();
            iServiceHandler svc  = m_service_handler_strategy.makeServiceHandler();

            svc.open(sock);
        }
Ejemplo n.º 2
0
        public override void handle_timer(object o)
        {
            AsyncTimer   ar         = (AsyncTimer)o;
            AsyncConnect op_connect = (AsyncConnect)ar.item();
            Socket       sock       = (Socket)op_connect.handle();

            if (!sock.Connected)
            {
                // Close the socket, timeout
                sock.Close();
            }
        }
Ejemplo n.º 3
0
        private static void e_completed(object sender, SocketAsyncEventArgs e)
        {
            if (e.ConnectSocket != null)
            {
                Console.WriteLine("Connection Established : ");

                AsyncConnect ac = (AsyncConnect)e.UserToken;
                ac.handler().handle_connect(ac);
            }
            else
            {
                Console.WriteLine("Connection Failed");
            }
        }
Ejemplo n.º 4
0
        public int connect()
        {
            //AsyncTimer t = new AsyncTimer();
            //t.open(this, t);

            AsyncConnect async_connect = new AsyncConnect();
            Socket       connect_sock  = new Socket(
                m_ep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

            async_connect.open(this, connect_sock);

            // Set a timeout for the completion either the
            // handlers connect or timer callbacks will happen first
            //t.wait(3000, m_async_connect);
            return(async_connect.connect(m_ep));
        }
Ejemplo n.º 5
0
 public virtual void handle_connect(AsyncConnect ar)
 {
 }