Home > other >  Inquire about TCP MTU of communication
Inquire about TCP MTU of communication

Time:09-22

Dear leaders,

I met some problems when doing the TCP communications, ask everybody to help!

1. I use a IOT devices to send data to the server, sends data length of 3088 characters at a time, on the server side data will automatically be divided into 3 packets, the length of the 1440144, 0288 respectively, I understand that this is because the TCP communications have MTU limit problem, but if I use python to write a client and a server local communication, sending the same length of 3088 characters of data, can be received at a time, don't understand why is this?

2. At the receiving end how can I see the content of the TCP packet header? Because may involve multiple clients send data to the server at the same time, the hope can through the header to sort data sorting, will not lead to a different client to data are put together by accident, or, is there a better solution, consult!

CodePudding user response:

Your first question, iot devices to send data processing and the speed and bandwidth are limited, at a time by more than the mtu in the bottom will be automatic cutting, server-side processing speed, when doing the recv action is likely to be seen packets come one by one, python local communications can once received, the TCP stack at the bottom of the stick packet processing, in order to reach the receiver data together, the server-side recv data reception area is greater than or equal to the length of the sender to send data, if the receive buffer is less than send the length of the data, the server will points several times to collect the data,
Second question, the service side accept the second parameter sockaddr is the client's IP address and port number, of course, can't use the upper application, because the IOT packets of baotou address information of the equipment can be after routing NAT will be replaced, recommended in IOT as calling the send in the valid data plus a IOT of MAC address or SN number to distinguish each device, the server will distinguish,
  • Related