I have an issu with my device when I connect by TCP sockets, because the client send the MSS in the SYN connection and the server (my device) is setting with the same MSS, but I don't want set this MSS in my device.
So how can I force setting this value in the MSS?
I tried setting the MTU value with the setsockopt function with the IP_DONTFRAG
You should be able to call
setsockopt
with theTCP_MAXSEG
option to set the TCP maximum segment size. Take a look at tcp(4) for the available options. You probably have to set the option beforeconnect
orlisten
.As for setting the IP MTU, the
IP_DONTFRAG
option will cause the packet to be dropped if a segment has a smaller MTU. The IP layer should negotiate to a reasonable MTU value by retransmitting a smaller packet after receiving a "fragmentation needed" response. TCP segments and IP packets are at different layers of the protocol stack -- in other words, a single TCP segment can span multiple IP packets. Changing the size of the IP packet does not effect the size of the TCP segment.