- Home /
[UNET] sending large files over network
I've read a lot of answers and posts but they were all really unsatisfactory. I just want to know how do you send data, large data, continuously, over the network.
I started calling SendByChannel on my networkconnection with a byte array of 512 * 512 pixels. I received the error:
buffer is too large (x) bytes. The maximum buffer size is 64K bytes
I then split my packets into chucks of 2^16 bytes, receiving an error about the maximum buffer size being 65535 bytes (one byte less than 2^16).
So I ran the same thing with one byte less, still receiving this error.
I then went to reduce it randomly to 64000, yet receiving another error:
Failed to send big message of 64009 bytes. The maximum is 63900 bytes on channel:3
It resulted in trying to send 63909 bytes with the same error. It's not even a multiple of 2.
I went down to 63800 finally sending packages, but receiving the error:
no free events for long message in the event queue
I mean come on... it can't be too hard getting the right numbers for the maximum package size, this event queue thing to yield it until there is some space...
How do you do this?
I discussed this with a colleague who did this with native C++ in Unreal Engine and Objective C and he just used a Streamwriter/ -reader and its callbacks and had no problem whatsoever just feeding it all the data and letting it handle the size.
Why is this so not documented, not supported... what am I missing?
Your answer
![](https://koobas.hobune.stream/wayback/20220612164955im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Network: any way to check in detail the data transmission? 1 Answer
Does Network.SetSendingEnabled() buffer or drop RPCs? 1 Answer
Problem with networking 2 Answers
Send model/GameObject from Server to Client 0 Answers
uNET - Send big amount of data over network (How to split send byte[]?) 8 Answers