send data question

This discussion was created from comments split from: How to set up local server for Bolt instead of remote server?.

Comments

  • And one more question:

    public void SendByteData()
    {
    RenderTexture.active = mRenderTexture;
    mTex.ReadPixels(new Rect(0, 0, mRenderTexture.width, mRenderTexture.height), 0, 0);
    mTex.Apply ();

    byte[] pngdata = mTex.EncodeToPNG ();

    if (mBoltConnection != null)
    {
    mBoltConnection.StreamBytes (testChannel, pngdata);

    }
    }


    IEnumerator SendByte()
    {
    while (canSend)
    {
    SendByteData ();
    yield return new WaitForSecondsRealtime(0.1f); //here can send normally
    //yield return new WaitForEndOfFrame(); //Enable here can't send normally,why?
    }
    }


    canSend = true;
    StartCoroutine (SendByte());


    Send data of using Unity3d coroutine , using line "yield return new WaitForSecondsRealtime(0.1f);" can send data ,the other line "yield return new WaitForEndOfFrame(); " can't send,why?