public override void handle_connect(AsyncConnect ar) { Socket sock = (Socket)ar.handle(); iServiceHandler svc = m_service_handler_strategy.makeServiceHandler(); svc.open(sock); }
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(); } }
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"); } }
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)); }
public virtual void handle_connect(AsyncConnect ar) { }