Search Unity

Unity Send huge file over Networking

Discussion in 'Multiplayer' started by Orion_78, Mar 13, 2018.

  1. Orion_78

    Orion_78

    Joined:
    Feb 13, 2014
    Posts:
    66
    I try to send a picture weight some mb over Networking (UNet) API of Unity. If try [ClientRpc] call, but it complain about the size of the packet... of course. I know I could use WWW to send this file, but think it is not possible to receive such packet over Lan Networking. Is it ?

    Do you know what is there is a proper way to send huge file ? Or do I reeealy have to manually split into many many packets or make another connection ?

    Thanks
     
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Fragment it and send it in pieces.
     
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Can you simply open your own sockets? A listener on the server and a connection on the client. I send large files through networks like that. It allows you to send large files with little overhead as well as break them up and buffer them if you need to. I've sent entire VMs (about 200GB) through networks this way.
     
  4. SrTartarus

    SrTartarus

    Joined:
    Feb 27, 2017
    Posts:
    9
    Hello Orion_78, you don´t need WWW to send and recive an image, absoluty you need to send the image in serveral chunks to all clients, maybe this can help you: https://answers.unity.com/questions/1113376/unet-send-big-amount-of-data-over-network-how-to-s.html

    Maybe this can help you as well: https://blog.stephencleary.com/2009/04/message-framing.html, this try to explain one of the most beginner mistakes when you use TCP/IP socket, so this really help me and i hope that those links help you and you can solve your problem.
     
  5. Orion_78

    Orion_78

    Joined:
    Feb 13, 2014
    Posts:
    66
    Oookay, so finally I arrive by making both : trunk into multiple packet and making another TCP connection that connect/disconnect with the UNet.
    Pain in the ass for just a picture to send... but both method works.

    By the way, I decide to use socket as it is waaaay faster than spliting into many packets.

    I might post a plugin/code soon
     
  6. teh1archon

    teh1archon

    Joined:
    Nov 28, 2014
    Posts:
    12
    pluging/code when?
     
  7. Runinforest

    Runinforest

    Joined:
    Mar 10, 2020
    Posts:
    1
    Hi there. I'm currently running into this problem too that UNET complains when I try to send large data (3M+ bytes) through ClientRpc. And I tried to use NetworkTransmitter to chunk it into smaller pieces and send them one by one but it takes too much time to send the data over. Could you explain a bit more about how you use socket to solve this issue? Thank you very much.