예제 #1
0
        internal static void TryWriteStream(IntPtr handle, ref uv_buf_t buf)
        {
            Debug.Assert(handle != IntPtr.Zero);

            var bufs   = new [] { buf };
            int result = uv_try_write(handle, bufs, bufs.Length);

            ThrowIfError(result);
        }
예제 #2
0
        internal static void TryWriteStream(IntPtr handle, ref uv_buf_t buf)
        {
            Contract.Requires(handle != IntPtr.Zero);

            var bufs   = new [] { buf };
            int result = uv_try_write(handle, bufs, bufs.Length);

            if (result < 0)
            {
                throw CreateError((uv_err_code)result);
            }
        }
예제 #3
0
        internal static void UdpTrySend(IntPtr handle, IPEndPoint remoteEndPoint, ref uv_buf_t buf)
        {
            Debug.Assert(handle != IntPtr.Zero);
            Debug.Assert(remoteEndPoint != null);

            GetSocketAddress(remoteEndPoint, out sockaddr addr);

            var bufs   = new[] { buf };
            int result = uv_udp_try_send(handle, bufs, bufs.Length, ref addr);

            ThrowIfError(result);
        }
예제 #4
0
        internal static void UdpTrySend(IntPtr handle, IPEndPoint remoteEndPoint, ref uv_buf_t buf)
        {
            Contract.Requires(handle != IntPtr.Zero);
            Contract.Requires(remoteEndPoint != null);

            GetSocketAddress(remoteEndPoint, out sockaddr addr);

            var bufs   = new[] { buf };
            int result = uv_udp_try_send(handle, bufs, bufs.Length, ref addr);

            if (result < 0)
            {
                throw CreateError((uv_err_code)result);
            }
        }