Esempio n. 1
0
        public ProtocolClient(ProtocolClientOptions clientOptions)
        {
            ClientOptions  = clientOptions;
            socket         = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            socket.NoDelay = true;

            Setup();
        }
Esempio n. 2
0
        public ProtocolClient(Socket socket, ProtocolClientOptions clientOptions)
        {
            this.socket    = socket;
            ClientOptions  = clientOptions;
            RemoteEndPoint = socket.RemoteEndPoint;

            Setup();
        }
Esempio n. 3
0
        public void Dispose()
        {
            Close();
            buffer         = null;
            RemoteEndPoint = null;
            ClientOptions  = null;
            payloadStream?.Dispose();

            if (UserToken is IDisposable)
            {
                (UserToken as IDisposable).Dispose();
            }
            else
            {
                UserToken = null;
            }

            UnsubscribeEvents();
        }
 public ProtocolServerOptions(ProtocolClientOptions clientOptions, EndPoint listenEndPoint, int maxConnectionQueue = 20)
 {
     ClientOptions      = clientOptions;
     MaxConnectionQueue = maxConnectionQueue;
     ListenEndPoint     = listenEndPoint;
 }