🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

sending a big file

Started by
3 comments, last by djsteffey 23 years, 2 months ago
lets say that I wanted to send a level file or something over the internet using TCP. Now lets say the map is maybe 5 MB big. How big of chunks should I send the data in. Could I send the data in 1 5 MB chunk and have it arrive correctly on the other side ? I know it wont all arrive at once but I am streaming with TCP and can write the data out to a file as it arrives. But is there any problem with sending the 5 MB chunk at once ? "I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma." - Mr. T
Advertisement
Theres a limit to the maximum size of your chunks in the Windows registry. 1.5mb is way too big. I think a standard limit is 1024b. I think the limit is called the MTU in the Registry.

Edited by - Brandisco on April 5, 2001 8:28:02 AM
Send the file in chunks of 1460 octets (bytes). 1500 bytes is the packet size most routers work with, and anything bigger than that gets broken into 1500 byte sized packets. Keep in mind that that includes the TCP header, which is 40 bytes.

1500 - 40 = 1460

As for the MTU, that has been optimized for a 56k modem. If you have a cable modem, you will want to increase it. There is a web-site(forgot the name) that can gauge you connection and tell you the optimal MTU for your computer. I set mine to 65000 and got a noticeable difference.
One site is www.speedguide.net. It has examples of the optimal settings and an explaination for what each setting is doing. If I remember right, it was mainly for Windows, not *nix systems.

-BlueNexus
-BlueNexus--This is my sig. There are many like it, but this one is mine.
Well, there are two different aspects here. Of course the TCP/IP stack will break up the 5MB file into many small packets. However, this is of no importance for you.

The interesting thing is the OS''s internal networking buffer. In theory you should be able to hand all the 5MB to the networking code in one large chunk and let it cope with it. However, the buffers of the networking code are unlikely to be big enough for such a huge amount of data. In other words, you''ll have to send the data in a loop which waits for the sendqueue to empty before sending another block of data. On Unix you can do this with select(), and it should be possible with WaitForMultipleObjects on Windows, too.

cu,
Prefect

Resist Windows XP''s Invasive Production Activation Technology!
One line of sourcecode says more than a thousand words.
Widelands - laid back, free software strategy

This topic is closed to new replies.

Advertisement