socket, UDP, SO_MAX_MSG_SIZE ???
> I'm implementing an application layer on top of UDP using the
> socket module, and I'm trying to determine the local machine's
> SO_MAX_MSG_SIZE. This option doesn't appear to be
> available in the socket module.
> I don't really know much about maximum UDP packet sizes.
> Do they generally default to the IP 65K limit? And if not, what's
> an alternate route for determining the max msg size?
Just been playing games with this ratty stuff in C++ on Windows, and I
found out the following:
IP packet size is generally ~1500 bytes by default. Don't know if that's
a given on all tcp/ip stacks or just Windows specific (I got the
impression that it was a standard default though).
UDP might only support max packet size of 512 bytes since anything larger
might be subject to fragmentation - again, ymmv. The 1500 bytes mentioned
above might be the max packet size before fragmentation otoh.
I think that the IP 64k max size is just the maximum possible size for an
IP packet and the default is typically set _much_ lower - typical max
seems to be 8k at most. (Windows uses a registry setting to set the max
ip size - by default 1500 bytes).
UDP on Windows is a poor stepchild - very little documentation.
People on comp.protocols.snmp and the net-snmp project at sourceforge
might be better equipped to answer your specific question about how to
determine actual max packet size on various machines. This is because
snmp uses udp so these people would probably want/need to find this info
too. FWIW, net-snmp runs on a fair number of platforms and if you dig
through their (imho vastly over factored) C source, you can probably find
the info. There is also a python wrapper for net-snmp called (I think)
pysnmp and it lives on sourceforge too.