Connect() public method

public Connect ( ) : bool
return bool
Beispiel #1
0
        public void ConfigureClient(string ip, string sPort)
        {
            int port;

            if (Int32.TryParse(sPort, out port))
            {
                Listener      = new TelemetryClient();
                Listener.IP   = ip;
                Listener.Port = port;
                if (Listener.Connect())
                {
                    IsHost   = false;
                    IsClient = true;
                }
                else
                {
                    FireError("Failed to connect to " + ip + ":" + port);
                }

                FireChange();
            }
            else
            {
                FireError("Invalid server port");
            }
        }
        public void ConfigureClient(string ip, string sPort)
        {
            int port;
            if (Int32.TryParse(sPort, out port))
            {
                Listener = new TelemetryClient();
                Listener.IP = ip;
                Listener.Port = port;
                if (Listener.Connect())
                {
                    IsHost = false;
                    IsClient = true;
                }
                else
                {
                    FireError("Failed to connect to " + ip + ":" + port);
                }

                FireChange();
            }
            else
            {
                FireError("Invalid server port");
            }
        }