On 19 Feb 2005 12:32:04 -0800, xm <(E-Mail Removed)> wrote:
> Hi there,
> I'm about to develop a few programs (or rather a few functions of
> one program) in order to understand and practice network programming.
>
> The application will be focused on file transfer (aiming for
> transfer stability and speed) and I also intend to work on a action
> game network programming, so I will probably deal with ultra quick
> information transfer, etc... but my first concerns are for transfer
> speed and stability.
>
> My question is this.
>
> I will play with both UDP and TCP, I would like to know what size
> should my packets be to make sure they don't get fragmented, etc...
> what is the best packet size in other words?
The best packet size, including any headers, is the mtu. But mtu is
dynamic for each connection based on negotiation between endpoints, and
anything between them if mtu path discovery is working. If you attempted
to use a fixed packet size small enough to "never" fragment (in the
200's?), it would not be very efficient.
I have noticed that Linux may actually use a higher mtu than set for (and
shown in ifconfig) if it can. For example if I set my LAN nic to mtu 1492
(routed elsewhere through pppoe to internet), it still uses 1500 for
traffic within my LAN.
|