Exemple #1
0
        public NetClient(PacketManager packetManager)
        {
            _packetManager = packetManager;

            _tcpNetClient = new TcpNetClient();
            _udpNetClient = new UdpNetClient();

            _tcpNetClient.RegisterOnConnect(OnConnect);
            _tcpNetClient.RegisterOnConnectFailed(OnConnectFailed);

            // Register the same function for both TCP and UDP receive callbacks
            _udpNetClient.RegisterOnReceive(OnReceiveData);
        }