Exemplo n.º 1
0
 public void async_accept(socket_tcp sck, functional.func <socket_result> cb)
 {
     try
     {
         _socket.BeginAccept(delegate(IAsyncResult ar)
         {
             socket_result res = new socket_result();
             try
             {
                 sck._socket         = _socket.EndAccept(ar);
                 sck._socket.NoDelay = true;
                 res.ok = true;
             }
             catch (System.Exception ec)
             {
                 res.message = ec.Message;
             }
             cb(res);
         }, null);
     }
     catch (System.Exception)
     {
         close();
         cb(new socket_result());
     }
 }
Exemplo n.º 2
0
        public async Task <socket_result> accept(socket_tcp sck)
        {
            generator host = generator.self;

            return(await host.wait_result((async_result_wrap <socket_result> res) => async_accept(sck, host.async_result(res))));
        }