Advertisement

DPlay: small packets vs. large packets

Started by November 02, 2004 07:45 AM
3 comments, last by cbenoi1 20 years, 3 months ago
Hi! What's better for Direct Play many small messages or fewer big messages ? What better , send 100 messages with size 12 bytes or 2 messages with size 600 bytes? Direct Play documentation said that small packets is better than big messages. But there no information about practical sizes of messages. What they mean about size of small packets ? 12-bytes or 1200-bytes or 12000-bytes ? Now i am manually collet small messages before they will be send to concrete user. Is there any reason in this ? Or DirectPlay will do it internally ?
Keep the packets below the network packet size, in your example 1200 bytes should be fine. Avoid fragmentation.
Advertisement
DirectPlay8 does packet coalescing for you. Just specify DPNSEND_COALESCE in the 'Send()' command. If a message is too big for the network's packet size (~ 1400 bytes), the message will be broken into smaller packets and reassembled back at destination; but by doing so you pay a performance penalty because DirectPlay8 defaults to DPNSEND_GUARANTEED on those messages.

-cb
Hi!

As i understand, if i use DPNSEND_GUARANTEED flag, then DirectPlay will be callapse my small messages into bigger. But , when my messages truly will be sent to remove client ? When maximum network message size will be reached ? But , this time may be too late for me (for remote client). In my network system ,all objects sends state messages after each frame update. This small packets i manually collapsing into 1 big , and send this big update message to clients after each frame. If DirectPlay will be collapsing messages for me ,can i say to DirectPlay: "Now , i whant to send all collapsed messages!".
> As i understand...

==== SMALL MESSAGES ====
If you send small messages with the DPNSEND_COALESCE flag, DirectPlay will internally accumulate them until some size or timer threshold is triggered, at which point it will send this one larger packet. Without this flag, messages are sent one by one as you would expect, but performance is not optimal.

==== LARGE MESAGES ====
Messages that are too big to fit into the packet payload are broken into small packets that are sent individually. Because DP8 now has to reconstruct _ALL_ those small packets into one big message again and it needs them all, DP8 silently sends them with a DPNSEND_GUARANTEE flag.

> When maximum network message size will be reached ?

The coalesced messages are sent in one packet either you exceed the packet size or when the socket is ready for sending. Some system variables can be queried through 'GetCaps()'. You can get the outstanding outbound messages with 'GetSendQueueInfo()'.

-cb

This topic is closed to new replies.

Advertisement