//this function connects the model to the server. public void connect(string ip, int port) { var task = Task.Run(() => telnetClient.connect(ip, port)); if (task.Wait(TimeSpan.FromSeconds(10))) { stop = false; } else { throw new Exception("Theres no information from the\nserver for over 10 seconds."); } }
public void connectClient() { string ip = ApplicationSettingsModel.Instance.FlightServerIP; int port = ApplicationSettingsModel.Instance.FlightCommandPort; client.connect(ip, port); }
public void createClient(string ip, int port) { ITelnetClient telnetClient = new MyTelnetClient(); this.telnetClient = telnetClient; telnetClient.connect(ip, port); }
/// <summary> /// this function execute the connectCommand. /// </summary> public void executeConnectCommand() { Connector connector = Connector.getInstance(); /* if connection established at first */ if (connectPerformed == 0) { connectPerformed = 1; // update the ip Ip = (string)Settings.Default["IP"]; ServerPort = Int32.Parse((string)Settings.Default["PortServer"]); int check = ts.startServer(ip, serverPort); if (check == 0) { // update the port ClientPort = Int32.Parse((string)Settings.Default["PortClient"]); mtc.connect(ip, clientPort); connector.setServer(ts); connector.setClient(mtc); IJoystickModel model = connector.getJoystickModel(); model.setTelnetClient(mtc); ts.readData(); } } /* if connection has been established once */ else { ts.closeServer(); Ip = (string)Settings.Default["IP"]; ServerPort = Int32.Parse((string)Settings.Default["PortServer"]); int check = ts.startServer(ip, serverPort); if (check == 0) { mtc.disconnect(); // update the port ClientPort = Int32.Parse((string)Settings.Default["PortClient"]); mtc.connect(ip, clientPort); connector.setServer(ts); connector.setClient(mtc); IJoystickModel model = connector.getJoystickModel(); model.setTelnetClient(mtc); ts.readData(); } } }
public void connect(string ip, int port) { telnetClient.connect(ip, port); Err_visiblity_Not_Connected = Visibility.Collapsed; stop = false; Start(); }
public bool connect() { if (telnetClient.connect()) { isConnected = true; return(true); } return(false); }
public int connect(string ip, int port) { // Try to connect to server. if (telnetClient.connect(ip, port) != 0) { Error = "Could not connect to server \nclick disconnect and try again"; return(-1); } return(0); }
/// <summary> /// connecting to the simulator (client and server) and starting to read from the server /// </summary> public void Connect() { ISettingsModel settings = ApplicationSettingsModel.Instance; ITelnetServer server = DataReaderServer.Instance; ITelnetClient client = FlightTelnetClient.Instance; server.Connect(settings.FlightServerIP, settings.FlightInfoPort); client.connect(settings.FlightServerIP, settings.FlightCommandPort); FlightBoardModel.Instance.ReadFromServer(); }
public CommandManager(ITelnetClient telnetClient) { this.telnetClient = telnetClient; try { telnetClient.connect("127.0.0.1", 5402); } catch { } }
/* * The method connect to the server by using the telnet client */ public int Connect(string ip, int port) { int check = 0; try { check = telnetClientHandler.connect(ip, port); if (check == 1) { isConnected = true; } } catch { // disconnect in case of error this.Disconnect(); } return(check); }
//this function connects the model to the server. public void connect(string ip, int port) { try { var task = Task.Run(() => telnetClient.connect(ip, port)); if (task.Wait(TimeSpan.FromSeconds(10))) { stop = false; ErrorMessage = " "; } else { //shoe the error message for no information from the server. ErrorMessage = "Theres no information from the\nserver for over 10 seconds."; } } catch { ErrorMessage = "The ip or port you entered is incorrect.\n please try again."; stop = true; } }
public static void connect() { telnetClient.connect(); }
public void connect(string ip, int port) { telnetClient.connect(ip, port); }