private void EmitPing()
    {
        Debug.Log("Ping服务器");

        Dictionary <string, string> data = new Dictionary <string, string>();

        data["callback_name"] = StaticManager.ping_packName;
        data["msg"]           = "ping!";

        udpClient.Emit(data["callback_name"], data["msg"]);
    }
    /// <summary>
    /// ping服务器
    /// sends ping message to UDPServer.
    ///     case "PING":
    ///     OnReceivePing(pack,anyIP);
    ///     break;
    /// take a look in TicTacttoeServer.cs script
    /// </summary>
    public void EmitPing()
    {
        Debug.Log("Ping服务器");
        //hash table <key, value>
        Dictionary <string, string> data = new Dictionary <string, string>();

        //JSON package
        data["callback_name"] = "PING";

        //store "ping!!!" message in msg field
        data["msg"] = "ping!!!!";

        //CanvasManager.instance.ShowAlertDialog ("try emit ping");
        //The Emit method sends the mapped callback name to  the server
        udpClient.Emit(data["callback_name"], data["msg"]);
        //CanvasManager.instance.ShowAlertDialog ("ping sended: "+serverFound);
    }
Esempio n. 3
0
    //************************ Sending Data to Server *************************************//

    public void EmitPing()
    {
        //hash table <key, value>
        Dictionary <string, string> data = new Dictionary <string, string>();

        //JSON package
        data["callback_name"] = "PING";

        //store "ping!!!" message in msg field
        data["msg"] = "ping!!!!";

        //The Emit method sends the mapped callback name to  the server
        udpClient.Emit(data["callback_name"], data["msg"]);
    }