Exemple #1
0
        public static AcceptSocket Bind(FileHandleEndPoint fileHandleEndPoint, ChannelWriter <ConnectionContext> acceptQueue, IoUringOptions options)
        {
            LinuxSocket s        = (int)fileHandleEndPoint.FileHandle;
            var         endPoint = s.GetLocalAddress();

            return(new AcceptSocket(s, endPoint ?? fileHandleEndPoint, acceptQueue, null, options, null));
        }
Exemple #2
0
        public static AcceptSocket Bind(IPEndPoint ipEndPoint, ChannelWriter <ConnectionContext> acceptQueue, MemoryPool <byte> memoryPool, IoUringOptions options, TransportThreadScheduler scheduler)
        {
            var         domain = ipEndPoint.AddressFamily == AddressFamily.InterNetwork ? AF_INET : AF_INET6;
            LinuxSocket s      = new LinuxSocket(domain, SOCK_STREAM, IPPROTO_TCP, blocking: false);

            s.SetOption(SOL_SOCKET, SO_REUSEADDR, 1);
            s.SetOption(SOL_SOCKET, SO_REUSEPORT, 1);
            s.Bind(ipEndPoint);
            s.Listen(options.ListenBacklog);

            return(new AcceptSocket(s, s.GetLocalAddress(), acceptQueue, memoryPool, options, scheduler));
        }