I'm writing a socket application that is running on Linux. My server machine is connected to a switch that is connected to a network. There are also other servers connected to the switch.

My client application sends 10 messages, each of the messages is 105 bytes. I build the whole packet and write it to the socket. Since 105*10=1050 < MTU, I assume it will not get fragmented while it is going to the target.

Am I wrong? Can the network devices on the path fragment my packet for a reason?


  • There's no way to really answer this because we don't know the MTU of the upstream devices.
    – Jesse P.
    Commented Feb 12, 2021 at 15:16
  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Commented Dec 23, 2021 at 16:30

2 Answers 2


YES. If the MTU somewhere along the path is smaller than your packet size, it will be fragmented.

This may not apply in your simple network, but it's possible in the real world.

One thing isn't clear from your description: sockets are stream-oriented. The stack will handle the fragmenting/defragmenting for you. I'm not sure why you're concerned.

  • thanks. Yes, you're right, the stack will handle the frag/defrag operations. I just want to send the 10 messages in the same packet, without defrag. Is it possible to guarantee this?
    – user73869
    Commented Feb 12, 2021 at 16:57
  • 2
    The minimum MTU for IPv4 is 576 bytes. You'd have to be no larger than that. But again, why do you care?
    – Ron Trunk
    Commented Feb 12, 2021 at 17:02
  • TCP sockets are stream-oriented, UDP sockets are datagram-oriented.
    – Barmar
    Commented Feb 13, 2021 at 17:02

Can the network devices on the path fragment my packet for a reason?

If it is IPv4, and the DF bit is clear, then yes, your packets can be fragmented in the path. The fragmentation and reassembly will be transparent to your application. Packets can get fragmented in the path, then the destination host will reassemble them at IPv4 before passing the packet up to the transport protocol.

If the DF bit is set and the packet needs fragmentation, then the packet is dropped. An ICMP message should be sent back telling you that the packet is too big.

IPv6 has eliminated path fragmentation, requiring every link in the path to have a minimum MTU of 1280, and it uses PMTUD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.