I am writing a file transferring program over TCP.
I want to set the don\'t fragment flag on IP
On a socket this is what I want to do:
int va
The Don't Fragment
bit is typically set on all TCP packets anyway. You don't have to do any special to achieve this.
The DF bit is typically used for path MTU (PMTU) discovery automatically by the operating system with TCP connections. If anything, you may have a socket option for disabling PMTU discovery which will have the effect of never setting DF (it's the IP_MTU_DISCOVER socket option on linux). If you leave PMTU discovery on, it will have the effect of always setting DF.
It wouldn't make sense to set/unset it on a packet-by-packet basis because you're using TCP and TCP operates on segments, not packets. If you want to set packet-level stuff, you need to use a lower-layer protocol.
google brought up this: http://lists.apple.com/archives/macnetworkprog/2006/Jul/msg00014.html
Looking at /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers
it seems to be called IP_DF
here:
netinet/ip.h
99:#define IP_DF 0x4000 /* dont fragment flag */
netinet6/in6.h
547:#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */