Esempio n. 1
0
        public void Listen(IServerNativeUnsafe channel, int backlog)
        {
            Debug.Assert(channel is object && _nativeUnsafe is null);
            Debug.Assert(backlog > 0);

            int result = NativeMethods.uv_listen(Handle, backlog, ConnectionCallback);

            NativeMethods.ThrowIfError(result);

            _nativeUnsafe = channel;
        }
Esempio n. 2
0
        public void Listen(IPEndPoint endPoint, IServerNativeUnsafe channel, int backlog, bool dualStack = false)
        {
            Contract.Requires(channel != null);
            Contract.Requires(backlog > 0);

            this.Validate();
            NativeMethods.GetSocketAddress(endPoint, out sockaddr addr);

            int result = NativeMethods.uv_tcp_bind(this.Handle, ref addr, (uint)(dualStack ? 1 : 0));

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

            result = NativeMethods.uv_listen(this.Handle, backlog, ConnectionCallback);
            if (result < 0)
            {
                throw NativeMethods.CreateError((uv_err_code)result);
            }

            this.nativeUnsafe = channel;
        }
Esempio n. 3
0
 internal void Register(IServerNativeUnsafe serverChannel)
 {
     Debug.Assert(serverChannel is object);
     _nativeUnsafe = serverChannel;
 }
Esempio n. 4
0
 protected override void OnClosed()
 {
     _nativeUnsafe = null;
     base.OnClosed();
 }
Esempio n. 5
0
        internal void Register(IServerNativeUnsafe serverChannel)
        {
            Contract.Requires(serverChannel != null);

            this.nativeUnsafe = serverChannel;
        }