Beispiel #1
0
    public bool ConnectToServer(string ipaddr, string port)
    {
        this.comSvcIPaddr = ipaddr;
        this.comSvcPort   = DefaultPort;
        if ((port != null) && (port != ""))
        {
            this.comSvcPort = port;
        }

        if (comSvc == null)
        {
            comSvc = new ComServiceServer();
        }
        if (comSvc.IsRunning() == false)
        {
            comSvc.StartService(masterClient, comSvcPort);
        }

        if (((ipaddr == "127.0.0.1") || (ipaddr == "localhost")) &&
            (masterClient == false))
        {
            Debug.Log("Cannot connect to local com service unless you are the host (master) client");
            return(false);
        }

        if (comCli == null)
        {
            comCli = new ComClient(ipaddr, comSvcPort, GetPlayerName());
        }
        return(comCli.PingService());
    }
Beispiel #2
0
 public bool ClientConnect()
 {
     return(comCli.PingService());
 }