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

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

            Setup();
        }
示例#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;
 }