예제 #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);
    }
예제 #2
0
파일: TcpPeer.cs 프로젝트: kkzaikk/U3D_Net
    //连接服务器
    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);
    }