コード例 #1
0
        public async void Connect(string ip, int port)
        {
            await Task.Run(() => telnetClient.Connect(ip, port));

            stop   = false;
            Status = "Connected";
            StartReading();
        }
 // Connect the model to the simulator.
 public void Connect(string ip, string port)
 {
     stop             = false;
     ConnectionStatus = telnetClient.Connect(ip, port);
     if (ConnectionStatus != "Status: Cannot connect (invalid ip or port)")
     {
         Start();
         SetJoystickSliders();
     }
 }
コード例 #3
0
 //A function to connect as a client to the simulator.
 public void ConnectCommandsClient(string FlightServerIP, int FlightCommandPort)
 {
     //disconnect from former connections.
     DisconnectCommandsClient();
     //connect if disconnected successfully
     if (!connectionClient)
     {
         tc.Connect(FlightServerIP, FlightCommandPort);
         connectionClient = true;
     }
 }
コード例 #4
0
 public void addClient(Tuple <String, int> key)
 {
     mutex.WaitOne();
     try
     {
         ITelnetClient client = clientsFactory.New();
         client.Connect(key.Item1, key.Item2);
         clients[key] = new ManagableClient(client, Timeout);
     }
     finally
     {
         mutex.ReleaseMutex();
     }
 }
コード例 #5
0
 // Connect to server.
 public void Connect()
 {
     ConnectionErrorMessage = string.Empty;
     try
     {
         client.Connect(this.ip, Int32.Parse(this.port));
         ErrorScreen = "Welcome to Flight Simulator!";
     }
     catch (Exception)
     {
         ConnectionErrorMessage = "Unable to connect, please try again";
         throw new Exception("Unable to connect, please try again");
     }
 }
コード例 #6
0
 //Connection to server.
 public void Connect(string ip, int port)
 {
     client = new MyTelnetClient();
     try
     {
         client.Connect(ip, port);
         MessageInd = true;
         Message    = "Connected to server.";
         Connected  = true;
     } catch (Exception)
     {
         MessageInd = true;
         Connected  = false;
         Message    = "Unable to connect to server.";
     }
 }
コード例 #7
0
 public void Connect()
 {
     try
     {
         // Try connect.
         telnetClient.Connect();
         Connecting = "connected";
         Initialize();
         this.start();
     } catch (Exception e)
     {
         // We couldn't connect.
         if (e.Message == "not connected")
         {
             this.ConnectError = true;
         }
     }
 }
コード例 #8
0
 public void Connect(string ip, int port)
 {
     myTelnetClient.Connect(ip, port);
 }
コード例 #9
0
 //function responsible to send IP,port to the model in order to connect to the server
 public void ConnectToSimulator()
 {
     model.Connect(IP, Port);
 }