Search Unity

Is NetworkConnection.SendBytes broken?

Discussion in 'Multiplayer' started by marcV2g, Oct 6, 2017.

  1. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    public bool SendBytes(byte[] bytes, int numBytes, int channelId);
    Parameters

    bytes The array of data to be sent.
    numBytes The number of bytes in the array to be sent.
    channelId The transport channel to send on.

    At lest while testing on host mode in 2017.2.0f2 it seems to ignore numBytes and send the length of the byte buffer array.

    //send 20 bytes
    Len[20],16,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    //receive
    Debug.LogFormat("read {0}/{1}", read.Position, read.Length);
    read 4/512
    //buffer
    Buffer = new byte[512];