SendString() публичный Метод

public SendString ( string str ) : void
str string
Результат void
Пример #1
0
    // Use this for initialization
    IEnumerator Start()
    {
        webSocketConn = new WebSocket(new Uri("ws://" + playsemIpPortAddress + "/playsemserenderer"));
        yield return(StartCoroutine(webSocketConn.Connect()));

        webSocketConn.SendString("{\"setSem\":[{\"sensoryEffectMetadata\":\"" + metadata + "\", \"duration\":\"60000\"}]}");

        while (true)
        {
            string reply = webSocketConn.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                if (reply.Contains("SemPrepared") && reply.Contains("true"))
                {
                    yield return(StartCoroutine(prepareVideo()));

                    webSocketConn.SendString("{\"setPlay\":[{\"currentTime\":\"0\"}]}");
                    yield return(StartCoroutine(playVideo()));
                }
            }
            if (webSocketConn.error != null)
            {
                Debug.LogError("Error: " + webSocketConn.error);
                break;
            }
            yield return(0);
        }
        webSocketConn.Close();
    }
Пример #2
0
        IEnumerator Start()
        {
            WebSocket w = new WebSocket(new Uri(url));

            yield return(StartCoroutine(w.Connect()));

            w.SendString("Hi there");
            int i = 0;

            while (true)
            {
                string reply = w.RecvString();
                if (reply != null)
                {
                    Debug.Log("Received: " + reply);
                    w.SendString("Hi there" + i++);
                }
                if (w.error != null)
                {
                    Debug.LogError("Error: " + w.error);
                    break;
                }
                yield return(new WaitForSeconds(1));
            }
            w.Close();
        }
    void Logout()
    {
        Debug.Log("Logout() called.");

        JObject   request = new JObject();
        JProperty jsonrpc = new JProperty("jsonrpc", "2.0");

        request.Add(jsonrpc);
        JProperty method = new JProperty("method", "logout");

        request.Add(method);

        JObject   param    = new JObject();
        JProperty username = new JProperty("username", this.username);

        param.Add(username);
        request.Add("params", param);

        JProperty id = new JProperty("id", 0);

        request.Add(id);

        Debug.Log(request.ToString(Formatting.None));
        ws.SendString(request.ToString());
    }
Пример #4
0
    //public getNewTweetCallBack callBack;

    // Use this for initialization
    IEnumerator Start()
    {
        WebSocket w = new WebSocket(new Uri("ws://127.0.0.1:3000"));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("Hi there");
        int i = 0;

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                //callBack (JSONparser.parseJSON(reply));
                w.SendString("Hi there" + i++);
            }
            if (w.Error != null)
            {
                Debug.LogError("Error: " + w.Error);
                break;
            }
            yield return(new WaitForSeconds(2.0f));

            yield return(0);
        }
        w.Close();
        Debug.Log("Closed");
    }
Пример #5
0
    IEnumerator SocketLoop()
    {
        yield return(StartCoroutine(ws.Connect()));

        ready = true;
        Debug.Log("Sending ready");
        ReadyAction();

        ws.SendString("Hello from client");

        int i = 0;

        while (true)
        {
            string reply = ws.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                ws.SendString("Got it!" + i++);
            }
            if (ws.error != null)
            {
                Debug.LogError("Error: " + ws.error);
                break;
            }
            yield return(0);
        }
        ws.Close();
    }
Пример #6
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log("Espacio pulsado");
         ws.SendString("PING");
     }
     // Movimiento
     if (Input.GetKeyDown(KeyCode.W))
     {
         ws.SendString("M");
     }
     if (Input.GetKeyDown(KeyCode.A))
     {
         ws.SendString("A");
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         ws.SendString("S");
     }
     if (Input.GetKeyDown(KeyCode.D))
     {
         ws.SendString("D");
     }
 }
Пример #7
0
    IEnumerator Start()
    {
        WebSocket w = new WebSocket(new Uri("ws://" + ip + ":" + port));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("START");

        while (true)
        {
            if ((int)((Time.time % 60) * NetworkSpeed) >= x)
            {
                w.SendString("Open for: " + x.ToString());
                x++;
            }

            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log(reply);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #8
0
        public IEnumerator listenInvoice(string invoiceId, Action <Invoice> actionOnInvoice)
        {
            Debug.Log("listenInvoice(): websocket start : invoiceId=" + invoiceId);
            WebSocket w = new WebSocket(new Uri("ws://echo.websocket.org"));

            yield return(w.Connect());

            w.SendString("Hi there");
            int i = 0;

            while (true)
            {
                string reply = w.RecvString();
                if (reply != null)
                {
                    Debug.Log("Received: " + reply);
                    w.SendString("Hi there" + i++);
                }
                if (w.error != null)
                {
                    Debug.LogError("Error: " + w.error);
                    break;
                }
                yield return(0);
            }
            w.Close();
        }
Пример #9
0
    // Use this for initialization
    IEnumerator Start()
    {
        WebSocket w = new WebSocket(new Uri("wss://genga-rp7rf.c9users.io"));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("Hi there");
        int i = 0;

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                w.SendString("Hi there" + i++);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #10
0
    // Use this for initialization
    IEnumerator Start()
    {
        //var s = "{\"g\":0,\"e\":2,\"p\":0,\"v\":{\"d\":1.323,\"x\":0,\"y\":0}}\n";
        //Debug.Log(s);

        //var N = JSON.Parse(s);
        //Debug.Log(N["v"]["d"].Value);
        //Debug.Log(N["v"]["d"].AsFloat);

        WebSocket w = new WebSocket(new Uri("ws://127.0.0.1:8080"));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("Hi there");
        int i = 0;

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                w.SendString("Hi there" + i++);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #11
0
	// Use this for initialization
	IEnumerator Start () {
		WebSocket w = new WebSocket(new Uri("ws://127.0.0.1:8080/websocket"));
		yield return StartCoroutine(w.Connect());

		int i = 0;
		w.SendString(PackMessage("Hi there", i));
		while (true)
		{
			string reply = w.RecvString();
			if (reply != null)
			{
				Message msg = UnpackMessage (reply);
				Debug.Log ("Received: " + msg.msg + ", " + msg.no);
				w.SendString (PackMessage ("Hi there", i));
			}
			if (w.error != null)
			{
				Debug.LogError ("Error: " + w.error);
				break;
			}

			++i;

			yield return 0;
		}
		w.Close();
	}
Пример #12
0
    // Use this for initialization
    IEnumerator Start()
    {
        WebSocket webSocket = new WebSocket(new Uri("ws://141.252.207.71:54000"));

        yield return(StartCoroutine(webSocket.Connect()));

        webSocket.SendString("Hi there");
        int i = 0;

        while (true)
        {
            string reply = webSocket.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
                webSocket.SendString("Hi there" + i++);
            }
            if (webSocket.error != null)
            {
                Debug.LogError("Error: " + webSocket.error);
                break;
            }
            yield return(0);
        }
        webSocket.Close();
    }
Пример #13
0
    IEnumerator Start()
    {
        // Connect to Websocket
        WebSocket w = new WebSocket(new Uri("ws://" + Constants.IP + ":" + Constants.PORT));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("UNITY|" + gameId + "|NEW");

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log(reply);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.SendString("UNITY|" + gameId + "|CLOSE"); //TODO: doesn't work
        w.Close();
    }
Пример #14
0
    // ----------------------------------------------------------------------
    // サーバーに要求を送信する処理.
    // ----------------------------------------------------------------------
    private void Send(string eventName, SocketData data)
    {
        data.eventName = eventName;
        string json = JsonUtility.ToJson(data);

        //Debug.Log(json);
        ws.SendString(json);
    }
Пример #15
0
    void StartButtonClicked()
    {
        Debug.Log("Start button clicked");

        int    cheater = Random.Range(1, 1 + Constants.NUM_PLAYERS);
        string word    = Constants.DICTIONARY[Random.Range(0, Constants.DICTIONARY.Length)];

        socket.SendString("START|" + cheater + "|" + word);
    }
Пример #16
0
    //private System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
    IEnumerator Start()
    {
        RemoteFrame   = new Frame();
        IsDataInQuaue = false;

        yield return(StartCoroutine(w.Connect()));

        // Send background command
        w.SendString("{\"background\":True}");
    }
Пример #17
0
    private void stop()
    {
        header stopper = new header();

        stopper.build("STOP", "Stopping the server", sent);
        string msg = "JSON{\"header\":" + JsonUtility.ToJson(stopper) + ",\"body\":{}}";

        //Debug.Log(msg);
        w.SendString(msg);
        done = true;
    }
Пример #18
0
        IEnumerator SendJoinRequest()
        {
            var dataJSON = JSON.Parse("{}");

            dataJSON["username"] = SharedData.Username;
            string payloadJSON = "{ \"method\" : [\"join\"], \"data\" : {\"username\" : \"" + SharedData.Username + "\"}}";

            Debug.Log(payloadJSON);
            m_socket.SendString(payloadJSON);
            yield return(0);
        }
Пример #19
0
    /// <summary>
    /// Calls the authorize method with the corresponding client id and secret.
    /// </summary>
    void Authorize()
    {
        Dictionary <string, string> authorizeDictionary = new Dictionary <string, string>();

        authorizeDictionary.Add("client_id", CLIENT_ID);
        authorizeDictionary.Add("client_secret", CLIENT_SECRET);

        w.SendString(
            CortexJsonUtility.GetMethodJSON
            (
                "authorize",
                (int)MethodsID.Authorize,
                authorizeDictionary
            ));
    }
Пример #20
0
    public void SendLoginRequest(string username, string password)
    {
        LoginMessage req = new LoginMessage();

        LoginCredentials creds = new LoginCredentials();

        creds.username = username;
        creds.password = password;

        req.type    = "LoginRequest";
        req.payload = creds;
        String json = JsonUtility.ToJson(req);

        w.SendString(json);
    }
Пример #21
0
 public void SendStr(string str)
 {
     if (ws != null)
     {
         ws.SendString(str);
     }
 }
Пример #22
0
    IEnumerator SockEventPost()
    {
        w = new WebSocket(new Uri("ws://gbakimchi.herokuapp.com/ws/"));
        yield return(StartCoroutine(w.Connect()));

        while (true)
        {
            if (this.readyToPost)
            {
                print("trying to post");
                DataObj sockdata = new DataObj();
                sockdata.type = "ws-" + this.sockType;
                sockdata.data = this.sockData;
                readyToPost   = false;
                string sockdata_str = sockdata.ToJson();
                print(sockdata_str);
                w.SendString(sockdata_str);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #23
0
 private void Update()
 {
     if (Input.GetKeyUp(KeyCode.X))
     {
         //do stuff
         Debug.Log("X triggered: running websocket");
         w.SendString(sendString);
         while (true)
         {
             string reply = w.RecvString();
             if (reply != null)
             {
                 Debug.Log("Received: " + reply);
             }
             if (w.error != null)
             {
                 //Debug.LogError ("Error: "+w.error);
                 break;
             }
             else
             {
                 return;
             }
         }
     }
 }
Пример #24
0
    /// <summary>
    /// This thread creates a connection with the cortex service through the websocket and then calls the login, createSession and subscribe methods.
    /// </summary>
    private IEnumerator Initialize()
    {
        w = new WebSocket(new Uri(EMOTIV_URL));
        yield return(StartCoroutine(w.Connect()));

        StartCoroutine(GetReply());

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

        loginDictionary.Add("username", username);
        loginDictionary.Add("password", userPassword);
        loginDictionary.Add("client_id", CLIENT_ID);
        loginDictionary.Add("client_secret", CLIENT_SECRET);
        w.SendString(
            CortexJsonUtility.GetMethodJSON
            (
                "login",
                (int)MethodsID.Login,
                loginDictionary
            ));

        Authorize();
        StartCoroutine(CreateSession());
        StartCoroutine(SubscribeStreams());
    }
    // Use this for initialization
    IEnumerator Start()
    {
        // https://docs.unity3d.com/ScriptReference/String.html
        WebSocket w = new WebSocket(new Uri(string.Format("ws://{0}:{1}", websocketServerIp, websocketServerPort)));

        yield return(StartCoroutine(w.Connect()));

        w.SendString("Hi there");

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #26
0
        public void GenerateAndSendWorldPacket(int pktsize, short opcode, Int32 zoneid, Int32 instanceid, params byte[][] list)
        {
            string serialized = GenerateWorldPacket(pktsize, opcode, zoneid, instanceid, list);

            ws_.SendString(serialized);
//			Debug.Log("SendPacket" + serialized);
        }
Пример #27
0
    public virtual void Send(WebSocket w)
    {
        string stringCmd = JsonUtility.ToJson(this);

        //Debug.Log(stringCmd);
        w.SendString(stringCmd);
    }
Пример #28
0
    private void send(MultiplayerServerBroadcastType type, ISerializable data)
    {
        string json      = JsonUtility.ToJson(data);
        string className = data.GetType().ToString();

        webSocket.SendString(type.ToString() + ":" + className + ":" + json);
    }
    public void Send(string data)
    {
        if (webSocket == null)
        {
            if (OnError != null)
            {
                OnError("Cannot send, websocket is null");
            }

            if (testMode)
            {
                testActions.Enqueue(() =>
                {
                    StartCoroutine(TestLight(data));
                });
                //StartCoroutine(TestLight(data));
                if (testActions.Count == 1 && !isRunning)
                {
                    testActions.Dequeue().Invoke();
                }
            }

            return;
        }
        Debug.Log("Sending" + data);
        webSocket.SendString(data);
    }
Пример #30
0
    // Use this for initialization
    IEnumerator Start()
    {
        //WebSocket w = new WebSocket(new Uri("ws://*****:*****@{\"sid\":\"52\",\"ts\":\"636314339710432260\",\"opType\":\"5\",\"opParams\":{\"posID\":\"4:0:3\",\"destPosID\":\"5:0:3\"}}");
        int i = 0;

        while (true)
        {
            string reply = w.RecvString();
            if (reply != null)
            {
                Debug.Log("Received: " + reply);
            }
            if (w.error != null)
            {
                Debug.LogError("Error: " + w.error);
                break;
            }
            yield return(0);
        }
        w.Close();
    }
Пример #31
0
 /// <summary>
 /// Sends a message from the buffer.
 /// If the buffer is empty or no connection is established it will not send.
 /// </summary>
 private void Send()
 {
     if (messageBuffer.Count <= 0)
     {
         return;
     }
     if (ws == null)
     {
         return;
     }
     try
     {
         if (!ws.IsConnected)
         {
             StartCoroutine(ReConnectCurrent());
         }
         else
         {
             var message = messageBuffer.Peek();
             //Debug.Log(message);
             //todo compress message
             ws.SendString(message);
             messageBuffer.Dequeue();
         }
     } catch (Exception e)
     {
         Debug.Log("Error during sening of message, buffering");
         Debug.Log(e);
     }
 }
Пример #32
0
	// Use this for initialization
	IEnumerator Start () {
        WebSocket w = new WebSocket(new Uri("ws://192.168.1.206:8888/ws"));
		yield return StartCoroutine(w.Connect());
		w.SendString("UnityTest");
		int i=0;
		while (true)
		{
			string reply = w.RecvString();
			if (reply != null)
			{
				Debug.Log ("Received: "+reply);
                w.SendString("UnityTest " + i++);
			}
			if (w.Error != null)
			{
				Debug.LogError ("Error: "+w.Error);
				break;
			}
			yield return 0;
		}
		w.Close();
	}
Пример #33
0
 // Use this for initialization
 IEnumerator Start()
 {
     WebSocket w = new WebSocket(new Uri("ws://127.0.0.1:3000"));
     yield return StartCoroutine(w.Connect());
     w.SendString("Hi there");
     int i = 0;
     while(true)
     {
         string reply = w.RecvString();
         if(reply != null)
         {
             Debug.Log("Received: " + reply);
             w.SendString("Hi there" + i++);
         }
         if(w.Error != null)
         {
             Debug.LogError("Error: " + w.Error);
             break;
         }
         yield return 0;
     }
     w.Close();
 }
Пример #34
0
        IEnumerator Connecting()
        {
            var env = ConstantEnviroment.Instance;
            string uri = env.Network.GetAddress(env.Scene.GetPort(SceneManager.GetActiveScene().name));
            Debug.Log("[Connecting] IP=" + uri + " Group=" + MyPlayerController.Instance.Group);
            var socket = new WebSocket(new Uri(uri));
            yield return StartCoroutine(socket.Connect());

            JsonHash hash = new SyncStatus() { Group = MyPlayerController.Instance.Group, Status = NetworkStatus.Join }.ToHash();
            socket.SendString(Json.Serialize(new JsonList() { hash }));

            while (true)
            {
                yield return null;
                var recv = socket.RecvString();
                Retrieve(recv);
                while(_SynchronizedQueue.Count > 0)
                {
                    Synchronized s = _SynchronizedQueue.Dequeue();
                    SyncStatus status = s as SyncStatus;
                    if (status == null) continue;

                    if (status.Status == NetworkStatus.Accept)
                    {
                        // サーバーと接続できた時
                        Synchronized.MyGroup = status.Group;	// 自分のGroupを登録
                        Synchronized.MyId = status.ShortId;	// 自分のIDを登録
                        MyPlayerController.Instance.SetID(status.Group, status.ShortId);
                        _StartTime = status.Time;	// 始まった時間
                        _WebSocket = socket;	// ソケット登録
                        Debug.Log("[Connected] Group=" + status.Group + " ID=" + Synchronized.MyId + " Time=" + _StartTime);
                        yield break;
                    }
                }
            }
        }
Пример #35
0
    /// Use this for initialization
    IEnumerator StartCommunicator()
    {
        WebSocket w = new WebSocket(new Uri("ws://192.168.33.138:8080"));
        if(!testLocally) {
            yield return StartCoroutine(w.Connect());
            w.SendString("Hi there, I'm the communicator");
        }
        int i=0;
        while (true)
        {
            sendingIntervalCountdown -= Time.deltaTime;
            if(sendingIntervalCountdown < 0) {
                sendingIntervalCountdown = sendingInterval;
                String toSend = "{\"x\":"+ball.position.x+",\"y\":"+ball.position.z+",\"z\":"+ball.position.y+"}";
                Debug.Log(toSend);
                if(!testLocally) {
                    w.SendString (toSend);
                }
            }
            string reply = null;
            if(!testLocally) {
                reply = w.RecvString();
            } else {
                reply = localTestCommand;
                localTestCommand = null;
            }
            if (reply != null)
            {
                Debug.Log ("Received: "+reply);
                Vector3 force = Vector3.zero;
                /*if(reply != null && reply.Length == ) {
                    if(reply[0] == '#') {

                    }
                }*/
                switch(reply) {
                case "jump":
                    force = new Vector3(0, 300, 0);
                    break;
                case "left":
                    force = new Vector3(500, 0, 0);
                    break;
                case "right":
                    force = new Vector3(-500, 0, 0);
                    break;
                case "forward":
                    force = new Vector3(0, 0, 500);
                    break;
                case "backward":
                    force = new Vector3(0, 0, -500);
                    break;
                case "color":
                    force = new Vector3(0, 0, -500);
                    break;
                }
                //Debug.Log (force);
                ball.GetComponent<Rigidbody>().AddForce(force);
                //w.SendString("Hi there"+i++);
            }
            if (!testLocally && w.error != null)
            {
                Debug.LogError ("Error: "+w.error);
                break;
            }
            yield return 0;
        }
        w.Close();
    }
Пример #36
0
 // Call this second client to actually send random commands.
 IEnumerator StartGenerateData()
 {
     WebSocket w = new WebSocket(new Uri("ws://192.168.33.138:8080"));
     if(!testLocally) {
         yield return StartCoroutine(w.Connect());
         w.SendString("Hi there, I'm the random generator");
     }
     int i=0;
     while (true)
     {
         String[] elements = {"jump", "left", "right", "forward", "backward"};
         String randomElem = elements[UnityEngine.Random.Range(0,elements.Length)];
         Debug.Log(randomElem);
         if(!testLocally) {
             w.SendString(randomElem);
         } else {
             localTestCommand = randomElem;
         }
         if (!testLocally && w.error != null)
         {
             Debug.LogError ("Error: "+w.error);
             break;
         }
         yield return new WaitForSeconds(1f);
     }
     w.Close();
 }
    // Use this for initialization
    IEnumerator StartWebSocket_CR()
    {
        WebSocket w = new WebSocket(new Uri("ws://128.2.236.66:3000"));
        yield return StartCoroutine(w.Connect());

		w.SendString("Ctrl Connected");
        while (true)
        {
            string res = w.RecvString();
			if (res != null)
            {
#if UNITY_EDITOR
                Debug.Log("Received: " + res);
#endif
                //w.SendString("Hi there" + i++);
                char[] delimiterChars = { ' ' ,'\t' };
				string[] parseStr = res.Split(delimiterChars);

				switch(parseStr[0]){
					case "m+":{
					_crowdSim.globalAttentionMean = SetValueFromString(_crowdSim.globalAttentionMean, true, parseStr);
						break;
					}
					case "m-":{
					_crowdSim.globalAttentionMean = SetValueFromString(_crowdSim.globalAttentionMean, false, parseStr);
						break;
					}
					case "d+":{
					_crowdSim.globalAttentionStDev = SetValueFromString(_crowdSim.globalAttentionStDev, true, parseStr);
						break;
					}
					case "d-":{
						_crowdSim.globalAttentionStDev = SetValueFromString(_crowdSim.globalAttentionStDev, false, parseStr);
						break;
					}
					case "u+":{
						_crowdSim.seatPosAttentionUpper = SetValueFromString(_crowdSim.seatPosAttentionUpper, true, parseStr);
						break;
					}
					case "u-":{
						_crowdSim.seatPosAttentionUpper = SetValueFromString(_crowdSim.seatPosAttentionUpper, false, parseStr);
						break;
					}
					case "l+":{
						_crowdSim.seatPosAttentionLower = SetValueFromString(_crowdSim.seatPosAttentionLower, true, parseStr);
						break;
					}
					case "l-":{
						_crowdSim.seatPosAttentionLower = SetValueFromString(_crowdSim.seatPosAttentionLower, false, parseStr);
						break;
					}

				}
			
				w.SendString("|Unity> currStat: m=" + _crowdSim.globalAttentionMean + ", dev=" + _crowdSim.globalAttentionStDev 
				             + ", A_up=" + _crowdSim.seatPosAttentionUpper + ", A_Low=" +  _crowdSim.seatPosAttentionLower + "." );

				
				//w.SendString("|Unity> blar blar" + res);

            }
            if (w.Error != null)
            {
#if UNITY_EDITOR
                Debug.Log("Error: " + w.Error);
#endif
                break;
            }
            yield return 0;
        }
        w.Close();
    }