public TcpConnection(Socket socket, IProtocol protocol, IPacketRouter router, IBufferPool bufferPool) : base(router, protocol) { if (socket == null) { throw new ArgumentNullException(nameof(socket)); } if (socket.ProtocolType != ProtocolType.Tcp) { throw new ArgumentException("Invalid socket protocol type. TCP required.", nameof(socket)); } if (!socket.Connected) { throw new ArgumentException("Socket is not connected.", nameof(socket)); } this.BaseSocket = socket; this.RemoteEndPoint = socket.RemoteEndPoint; this.BufferPool = bufferPool; this.SilentSend = true; }
public ServerSession(TcpClient client, IPacketRouter packRouter = null, IPacketCompress packetCompress = null) { System.Diagnostics.Debug.Assert(client != null && packRouter != null); _tcpClient = client; _packRouter = packRouter ?? new ServerPacketRouter(); _packetCompress = packetCompress ?? new PacketCompress(); }
public ClientSession(string hostname, int port, IPacketRouter packetRouter, IPacketCompress packetCompress = null) { System.Diagnostics.Debug.Assert(packetRouter != null); _port = port; _hostname = hostname; _packRouter = packetRouter; _packetCompress = packetCompress ?? new PacketCompress(); }
public ServerTcpRouter(string ip, int port, IPacketRouter protocol) { UnityEngine.Debug.Assert(protocol != null && !string.IsNullOrEmpty(ip)); _port = port; _address = IPAddress.Parse(ip); _protocol = protocol; _listener = new TcpListener(_address, _port); }
public ClientSession(SessionScope sessionScope, IPacketRouter packetRouter, IBufferPool <byte> bufferPool, ObjectPool <UncompressedPacket> uncompressedPacketObjectPool) { SessionScope = sessionScope; _tcpClient = new TcpClient(); _bufferPool = bufferPool; _uncompressedPacketObjectPool = uncompressedPacketObjectPool; _packetRouter = packetRouter; _outcomingPacketObserver = new OutcomingPacketObserver(this); _outcomingPacketDispatcher = new ActionBlock <UncompressedPacket>(SendOutcomingPacket); }
public LibuvConnection(UvTcp socket, IProtocol protocol, IPacketRouter router, IBufferPool bufferPool) : base(router, protocol) { this.BaseSocket = socket ?? throw new ArgumentNullException(nameof(socket)); this.RemoteEndPoint = socket.GetPeerEndPoint(); this.BufferPool = bufferPool; this.SilentSend = true; }
public VirtualConnection(IConnection baseConnection, IPacketRouter router, IProtocol protocol) : base(router, protocol) { this.BaseConnection = baseConnection; }
public Task SetPacketRouter(IPacketRouter packetRouter) { _packetRouter = packetRouter; return(Task.CompletedTask); }
public LoginHandler(IPacketSink packetSink, IPacketRouter packetRouter, IEventAggregator eventAggregator) { _packetSink = packetSink; _packetRouter = packetRouter; _eventAggregator = eventAggregator; }
protected Connection(IPacketRouter router, IProtocol protocol) { this.Router = router; this.Protocol = protocol; }
public HandshakingHandler(IPacketSink packetSink, IPacketRouter packetRouter) { _packetSink = packetSink; _packetRouter = packetRouter; }