int ConnectGateServer(Message _msg)
    {
        Debug.Log("connect gate server start");
        GameManager.Instance.GamePause();
        m_Net.DisConnect();
        ServerInfo gateserver = ServerInfo.Parser.ParseFrom(_msg.m_data);

        if (m_Net.ConnectServer(gateserver.MIp, gateserver.MPort) < 0)
        {
            return(-1);
        }

        MsgHead msg_head = new MsgHead
        {
            m_usrid = _msg.m_usrid
        };

        byte[] data = new byte[16];

        msg_head.EnCode(data, 0);

        m_Net.Send(data, 16);

        UIManager.Instance.ClosePanel("LoginPanel");
        UIManager.Instance.ShowPanel("PanelMain");
        GameManager.Instance.GameStart();
        Debug.Log("connect gate server end");
        return(0);
    }
Beispiel #2
0
    void Start()
    {
        ClientSocket mSocket = new ClientSocket();

        mSocket.ConnectServer("127.0.0.1", 8088);
        mSocket.SendMessage("服务器傻逼!");
    }
Beispiel #3
0
 void Start()
 {
     clientsocket.ConnectServer("10.0.128.244", 8088);
     //string tmp =
     //listenServer = new Thread (reciveServer);
     //listenServer.Start ();
 }
    // Use this for initialization
    void Start()
    {
        ClientSocket mSocket = new ClientSocket();

        mSocket.ConnectServer("192.168.1.240", 8088);
        mSocket.SendMessage("服务器傻逼!");
    }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        //testNet = new TestNet("TCP");


        mSocket = new ClientSocket();
        mSocket.ConnectServer("127.0.0.1", 8088);
    }
Beispiel #6
0
 void Start()
 {
     mSocket = new ClientSocket();
     mSocket.ConnectServer("127.0.0.1", 8080);
     //mSocket.SendMessage("服务器傻逼!");
     //这里的数值是保留小数点后一位,四舍五入
     //string str = vr_camera.localPosition.ToString();
 }
Beispiel #7
0
    public void Connect(ServerEntity server, DefAction callBack)
    {
        this.connectCallBack = callBack;
        StateObj state = new StateObj();

        state.OnConnect = OnConnect;
        clientSocket.ConnectServer(server.ip, server.port, state);
    }
Beispiel #8
0
    // Use this for initialization
    void Start()
    {
        ClientSocket mSocket = new ClientSocket();

        mSocket.ConnectServer("127.0.0.1", 8088);
        mSocket.SendMessage("服务器**!");
        Debug.Log("start");
    }
Beispiel #9
0
    void Start()
    {
        GameObject pBoard   = GameObject.FindGameObjectsWithTag("pBoard")[0];
        ReadFile   readFile = pBoard.GetComponent(typeof(ReadFile)) as ReadFile;

        this.mSocket = new ClientSocket();
        mSocket.ConnectServer(readFile.GetHostServerIdentifier(), readFile.GetHostServerPort());
        InvokeRepeating("SendHeartbeat", 0, Configuration.Config.HEARTBEAT_FREQUENCY);
    }
Beispiel #10
0
    public void ConnectServer(int port = 8088, string IP = "127.0.0.1")
    {
        mSocket.ConnectServer(IP, port);

        if (mSocket.IsConnected)
        {
            //开启线程 等待接收消息
            ThreadStart threadStart = new ThreadStart(Recieve);
            thread = new Thread(threadStart);
            thread.Start();
        }
    }
Beispiel #11
0
 void Start()
 {
     if (m_Net.ConnectServer("192.168.80.3", 2222) < 0)
     {
         Debug.Log("Connect Server failed!");
         // TODO 不进入 update
     }
     else
     {
         Debug.Log("connect server sucess!");
     }
     GamePause();
 }
Beispiel #12
0
    public void Start()
    {
        bool bRetCode = false;

        // 连接服务器
        bRetCode = m_RoomSocket.ConnectServer(m_szServerIP, m_nPort);
        if (!bRetCode)
        {
            ClientDelegate.OnShowMsgEvent("连接房间服务器失败");
            return;
        }
        ClientDelegate.OnShowMsgEvent("连接房间服务器成功");

        // 启动处理协程
        StartCoroutine(OnHanleDataFiber());
    }
    // Use this for initialization
    void Start()
    {
        CSLoginInfo mLoginInfo = new CSLoginInfo();

        mLoginInfo.UserName = "******";
        mLoginInfo.Password = "******";
        CSLoginReq mReq = new CSLoginReq();

        mReq.LoginInfo = mLoginInfo;

        byte[]       data    = CreateData((int)EnmCmdID.CS_LOGIN_REQ, mReq);
        ClientSocket mSocket = new ClientSocket();

        mSocket.ConnectServer("127.0.0.1", 8088);
        mSocket.SendMessage(data);
    }
Beispiel #14
0
    public IEnumerator Start()
    {
        Role.sn = agent.GetDeviceSN();
        //SystemInfo.deviceUniqueIdentifier
        Debug.LogError("SystemInfo:" + Role.sn);
        string url      = "http://120.78.214.169/study/api/server/login?vrno=" + Role.sn + "&port=2021";
        WWW    postData = new WWW(url);

        yield return(postData);

        if (postData.error != null)
        {
            //Debug.Log(postData.error);
            //loginResult(null);
            //Debug.Log("Server-StudentRegister Failed:" + userName + " " + password);
            Debug.Log("Error, postData" + postData.error);
        }
        else
        {
            Debug.Log(postData.text);
            //{"id":9,"name":"大维","userName":"******","password":"******","gradeId":2,"schoolId":1}

            JsonData data = JsonMapper.ToObject(postData.text);

            //StudentInfo info = new StudentInfo();
            //info.id = (int)data["id"];
            //info.gradeId = (int)data["gradeId"];
            //info.schoolId = (int)data["schoolId"];
            //info.name = (string)data["name"];
            //info.userName = (string)data["userName"];
            //info.password = (string)data["password"];
            Role.ip   = (string)data["server_ip"];
            Role.port = (int)data["server_port"];

            mSocket = new ClientSocket();
            mSocket.ConnectServer(Role.ip, Role.port, ReceiveMsg);

            serverSocket = new ServerSocket();
            //mSocket.SendMessage("服务器傻逼!");
            // loginResult(info);
            //Debug.Log("Server-StudentRegister Sucess:" + info.id + " " + userName + " " + password);

            // InvokeRepeating("Run", 0, 1f);
        }
    }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     mSocket.ConnectServer("127.0.0.1", 8088);
     mSocket.SendMessage("hello server");
 }
Beispiel #16
0
 //Use this for initialization
 void Start()
 {
     mSocket.ConnectServer("127.0.0.1", 8088);
     mSocket.SendMessage("服务器你好!");
 }
Beispiel #17
0
 public void StartClient()
 {
     socket = new ClientSocket();
     socket.ConnectServer("127.0.0.1", 3000);
     Debug.LogWarning("StartClient...");
 }
    //------------------------------------------------------------------------

    /// <summary>
    /// 链接服务器按钮
    /// </summary>
    public void _ConnectServerButton()
    {
        myClientSocket = new ClientSocket();
        myClientSocket.ConnectServer("127.0.0.1", 8088);
    }
 /// <summary>
 /// 连接到服务器的接口
 /// </summary>
 public void ConnectToServer()
 {
     mSocket = new ClientSocket();
     mSocket.ConnectServer(ip, port, time_out);
 }
Beispiel #20
0
 // Use this for initialization
 void Start()
 {
     mSocket.ConnectServer("127.0.0.3", 8088);
     mSocket.SendMessage("你好服务器!");
 }