Ejemplo n.º 1
0
        private PortalClient(Socket client, ushort?serverID, bool remote)
        {
            _Client = client;

            _Client.ReceiveBufferSize = PortalPacket.MaxSize;
            _Client.SendBufferSize    = PortalPacket.MaxSize;

            _Client.NoDelay = true;

            _ServerID = serverID;

            _IsRemoteClient = remote;
            _IsLocalClient  = !remote;

#if DEBUG
            _DisplaySendOutput = true;
            _DisplayRecvOutput = true;
#endif

            var ep = _IsRemoteClient
                                ? _Client.RemoteEndPoint ?? _Client.LocalEndPoint
                                : _Client.LocalEndPoint ?? _Client.RemoteEndPoint;

            _EndPoint = (IPEndPoint)ep;

            Handlers = new Dictionary <ushort, PortalPacketHandler>();

            PortalPacketHandlers.RegisterHandlers(this);
        }
Ejemplo n.º 2
0
        private PortalClient(Socket client, ushort?serverID, bool remote)
        {
            _ReceiveQueue = new ConcurrentQueue <PortalBuffer>();

            _Client = client;

            //_Client.ReceiveBufferSize = PortalPacket.MaxSize;
            //_Client.SendBufferSize = PortalPacket.MaxSize;

            _Client.ReceiveTimeout = 10000;
            _Client.SendTimeout    = 10000;

            _Client.Blocking = true;
            _Client.NoDelay  = true;

            _NextPing   = Portal.Ticks + 60000;
            _AuthExpire = _PingExpire = Int64.MaxValue;

            _ServerID = serverID;

            _IsRemoteClient = remote;
            _IsLocalClient  = !remote;

#if DEBUG
            _DisplaySendOutput = true;
            _DisplayRecvOutput = true;
#endif

            var ep = _IsRemoteClient
                                ? _Client.RemoteEndPoint ?? _Client.LocalEndPoint
                                : _Client.LocalEndPoint ?? _Client.RemoteEndPoint;

            _EndPoint = (IPEndPoint)ep;

            Handlers = new Dictionary <ushort, PortalPacketHandler>();

            PortalPacketHandlers.RegisterHandlers(this);
        }