Exemplo n.º 1
0
        static void OnWatcherCallback(IntPtr handle, int status)
        {
            var request = GetDataFromHandle <ConnectRequest>(handle);

            if (status < 0)
            {
                request.error = Libuv.CreateError((uv_err_code)status);
            }
            request.OnWatcherCallback();
        }
Exemplo n.º 2
0
        public ConnectRequest(IntPtr handle, IPEndPoint remoteEndPoint) : base(uv_req_type.UV_CONNECT, 0)
        {
            Libuv.GetSocketAddress(remoteEndPoint, out sockaddr addr);
            int result = Libuv.uv_tcp_connect(
                this.Handle,
                handle,
                ref addr,
                WatcherCallback);

            //ThrowIfError(result);
            if (result < 0)
            {
                error = Libuv.CreateError((uv_err_code)result);
                OnWatcherCallback();
            }
        }