Archived

This topic is now archived and is closed to further replies.

fireking

get rid of tcp's "breakup" behavoir

Recommended Posts

fireking    122
does anyone know how to effectively solve tcp''s break up behavoir, when it takes your sent message and breaks it up into several packets? i have heard that this can happen, but from my personal tests, i have never seen it happen. --Fireking Owner/Leader Genetics 3rd Dimension Development

Share this post


Link to post
Share on other sites
Xiol    122
What do you mean by "solve" the problem?

TCP''s breaking-up of data into many packets is TCP''s solution to the problem of sending data over the internet. Basically any chunk larger than the MTU (1400 bytes give or take, it''s system dependent), will be split into smaller packets.

Since this is handled at the protocol layer, the fact that data may come in one or many packets is irrelevant to a socket level program, which views TCP as one continious stream.

Share this post


Link to post
Share on other sites
Anon Mike    1098
As you''ve no doubt read several times you must buffer partial messages yourself. There is no way around that.

If you''re using TCP you must forget that there is any such concept as a "packet" because there isn''t. You have a stream of bytes and that''s it.

You probably haven''t seen it because you''re probably testing on a LAN with lightly loaded machines, or even worse you''re testing using loopback to the same machine. Do your test on the Internet with machines seperated by a dozen routers and you''ll see it.

Share this post


Link to post
Share on other sites
Kylotan    9850
It looks like you''re trying very hard to avoid having to rewrite your code Lots of your questions have seemed to address this issue. TCP/IP works as a stream of bytes, and if you don''t rewrite your code to take that into account, you''ll have problems sooner or later. It may, or may not, break up all your data. You just have to live with it, or pick a different protocol.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

Share this post


Link to post
Share on other sites
KalvinB    102
I''ve posted a number of times that to "solve" the problem you have to buffer your data before accessing it. I see it all the time (mostly with multiple messages per packet) on a 100Mbit LAN.

The code for my Winsock Class is available in the "My Released Source" of the DevZone. You can download that as see the operations done to a packet and how the GetMessage() method works to retrieve a single complete message.

You can either sit down and use the DPlay example from the SDK to get DPlay going and avoid all of this out of the box. Or you can sit down and work the problems out yourself in Winsock.

There is no magic command that makes all of this go away. You either handle it yourself in Winsock using buffers or let the DirectPlay black box do it for you.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post


Link to post
Share on other sites