IP Don't fragment bit on Mac OS

前端 未结 4 1364
猫巷女王i
猫巷女王i 2020-12-21 03:52

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         


        
4条回答
  •  爱一瞬间的悲伤
    2020-12-21 04:23

    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.

提交回复
热议问题