Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Weird Network behavior

Discussion in 'Multiplayer' started by Deleted User, Sep 27, 2016.

  1. Deleted User

    Deleted User

    Guest

    Hi,

    I send an byte array as a member of a NetworkMessage over the network.
    1. But when i send a byte array with a length of 1394 or greater the other connections get weird content. With the size of 1392 everything is ok.
    2. And sending an odd size (greater than 1392) wont recognize.
    If you want to do it yourself:
    1. Open the project in Unity, build and run, start in editor.
    2. Start one as server and one as client.
    3. And send now the given sizes.
    It will create an byte array with this size. The first byte is 0xFF. The others the char 'U'. (Only if you send by size)

    Can you tell my why this happens?
     

    Attached Files:

  2. cjf93

    cjf93

    Joined:
    Apr 28, 2014
    Posts:
    14
    Im not sure at 100% but has something to do with the transfer protocol.

    Your maximum transfer unit(MTU) its something like 1500bytes but due to headers and security checks etc you have only 1392 bytes of information.

     
  3. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,102
    You should use a fragmented channel.
     
  4. Deleted User

    Deleted User

    Guest

    After 63 900 bytes the end is reached with NetworkMessages.

    SendingBytes is interesting here, lets see.