We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
When I send an TCP packet (1022 bytes) from my PC, I receive the packet in 2 times (with TCP_EVT_DATA). 536 bytes first and 486 bytes.
I don't understand why I can't receive it in one time.
Anybody can help me ?
Thanks.
TCP data provides a streamed data link. You should not assume or expect a request to be sent in one block.
However, you might want to look at the Maximum Segment Size.
Here is the config : #define TCP_MTU 1460 /* TCP default max. transfer unit */ #define TCP_DEF_MSS 1460 /* TCP default max. segment size option */
Indeed.
This is a general property of TCP/IP - nothing specifically to do with Keil, ARM, etc...
The beauty of TCP/IP is that it is available on just about every platform imaginable (and several the you wouldn't imagine!). Therefore, interoperability is key - you absolutely must not rely upon any "special case" bebaviours...
For example, look at the text between "<LECTURE>" and "</LECTURE>" at the start of the following article: www.jmarshall.com/.../
Ok
My old platform (with 8 bits Atmel CPU ) receive the packet in one time.
So why with this configuration, #define TCP_MTU 1460 /* TCP default max. transfer unit */ #define TCP_DEF_MSS 1460 /* TCP default max. segment size option */ I receive always first 536 bytes. Why 2 packets, It is bad for the performance I think
Check the function: tcp_max_dsize
... that the PC actually sent it as a single packet?
Yes I sent only one packet but If I check with an sniffer I see the 2 packets.
tcp_max_dsize return 1460
How do you send it? How do you know that it is actually sent as just one single packet?
"I check with an sniffer I see the 2 packets."
What "sniffer"? Where are you "sniffing"?
Are there any other devices (routers, etc) between the PC and your ARM target?
How do you send it?
With the Win32 Socket send function :
int send( __in SOCKET s, __in const char *buf, __in int len, __in int flags );
It is the Microsoft Network Monitor program running on the PC which send the TCP packet.
All are connected to an switch but I try with the pc connected directly to the ARM target and it is the same thing
And does that give you any guarantee that it will send only a single packet?
"It is the Microsoft Network Monitor program running on the PC which send the TCP packet."
Well, if that tells you that there were two packets, then I guess you'd better believe it!
I know there is 2 packets and I want to know why.
If I send an packet smaller than the Maximum Transfer Unit (MTU), normally I will be able to receive it in one packet.
Maybe there is something to configure in the TCP opening connection, but I find nothing
It's the PC that decided to send two packets, so this is a PC question - it has nothing to do with Keil or their libraries!
I don't think so, because with the same PC, same application, same send socket function, but Atmel 8 bits target, Only one packet is sent
"same PC, same application, same send socket function, but Atmel 8 bits target, Only one packet is sent"
Are you sure that only 1 packet is sent?
What does your sniffer say?