Esempio n. 1
0
    //连接服务器
    public bool Connect()
    {
        acceptNet = true;

        Close();
        _socketCon = new SocketConnect(host, port);

        if (_socketCon.Open())
        {
            Debug.Log("连接服务器成功!");

            //20150912 add////////////////////////////////////////
            thread = new Thread(new ThreadStart(CheckReceive));
            thread.Start();
            //end////////////////////////////////////////////////


            return(true);
        }
        Debug.LogError("连接服务器失败!");
        return(false);
    }
Esempio n. 2
0
    //连接服务器
    private bool Connect()
    {
        acceptNet = true;

        StopService();

        _socketCon = new SocketConnect(host, port);

        if (_socketCon.Open())
        {
            Debug.Log("连接服务器成功!");

            serviceState = ENetServiceState.Running;

            thread = new Thread(new ThreadStart(CheckReceive));
            thread.Start();

            return(true);
        }
        Debug.LogError("连接服务器失败!");
        return(false);
    }