示例#1
0
        public async Task CommunicatorTests()
        {
            var server = new Communicator();
            await server.StartServer();

            var client = new Communicator(13001, new NetworkClient("Test", new TcpClient()), new NetworkListener());
            await client.ConnectToServer("192.168.1.6", 13001);

            //await Task.Delay(1000);
            await client.SendMessage(new FileStartMessage(new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }));

            await Task.Delay(5000);
        }
        private async Task <bool> ConnectToServer()
        {
            try
            {
                await Communicator.ConnectToServer(RootPath, CommunicationPort);
            }
            catch (Exception e)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
 public void CreateCommunicator()
 {
     _commands     = new Dictionary <string, Command>();
     _communicator = new Communicator();
     _communicator.ConnectToServer(_ipAddress, _port);
 }