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; }
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; }
internal void Register(IServerNativeUnsafe serverChannel) { Debug.Assert(serverChannel is object); _nativeUnsafe = serverChannel; }
protected override void OnClosed() { _nativeUnsafe = null; base.OnClosed(); }
internal void Register(IServerNativeUnsafe serverChannel) { Contract.Requires(serverChannel != null); this.nativeUnsafe = serverChannel; }