示例#1
0
        private static async Task ConnectToMasterRouterAsync(IPAddress address, int port)
        {
            TcpClient routerClient = null;

            LogonServices.InteropConnectionManager.Connect(tcpClient => routerClient = tcpClient);

            var routingClient = new AERoutingClient(routerClient, LogonServices.InteropPacketHandler,
                                                    LogonServices.IncomingRoutingMiddlewareHandler,
                                                    LogonServices.OutgoingRoutingMiddlewareHandler,
                                                    LogonServices.ObjectRepository);

            var chbp = new ClientHandshakeBeginPacket
            {
                Protocol  = Constants.LatestAEProtocolVersion,
                Password  = "******",
                Component = new RoutingComponent
                {
                    Type = ComponentType.UniversalAuthServer
                }
            };

            await routingClient.SendDataAsync(chbp.FinalizePacket());

            await routingClient.ListenForDataTask();

            LogonServices.ObjectRepository.RemoveObject(routingClient.ClientGuid);
        }
示例#2
0
        private static async Task ConnectToMasterRouterAsync(IPAddress address, int port)
        {
            var client = new TcpClient();
            await client.ConnectAsync(address, port);

            var routingClient = new AERoutingClient(client, DatabaseServices.InteropPacketHandler,
                                                    DatabaseServices.IncomingRoutingMiddlewareHandler,
                                                    DatabaseServices.OutgoingRoutingMiddlewareHandler,
                                                    DatabaseServices.ObjectRepository);

            var chbp = new ClientHandshakeBeginPacket
            {
                Protocol  = Constants.LatestAEProtocolVersion,
                Password  = "******",
                Component = new RoutingComponent
                {
                    Type = ComponentType.DatabaseComponent
                }
            };

            await routingClient.SendDataAsync(chbp.FinalizePacket());

            await routingClient.ListenForDataTask();

            DatabaseServices.ObjectRepository.RemoveObject(routingClient.ClientGuid);
        }