Exemple #1
0
        internal NetSocket(INetAddress address, BufferPool bufferPool, SocketEventArgPool socketPool, Socket baseSocket)
        {
            this.BufferPool         = bufferPool;
            this.SocketPool         = socketPool;
            this.BaseSocket         = baseSocket;
            this.BaseSocket.NoDelay = true;

            this.IsClient   = true;
            this.OnAccepted = delegate { };
            this.OnReceived = delegate { };
            this.OnSent     = delegate { };
            this.OnFault    = delegate { };
        }
Exemple #2
0
        public NetSocket(INetAddress address, BufferPool bufferPool, SocketEventArgPool socketPool)
        {
            this.Address    = address;
            this.BufferPool = bufferPool;
            this.SocketPool = socketPool;

            this.BaseSocket             = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.BaseSocket.LingerState = new LingerOption(true, 0);
            this.BaseSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);

            this.IsClient   = false;
            this.OnAccepted = delegate { };
            this.OnReceived = delegate { };
            this.OnSent     = delegate { };
            this.OnFault    = delegate { };
        }