Author Topic: why are the packets only 128 bytes long?  (Read 6875 times)

Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
why are the packets only 128 bytes long?
« on: December 18, 2009, 06:14:03 PM »
Is there anything in uTasker that would cause the PC (Linux) side of ethernet communications to only send 128 byte length packets?
I've attached a wireshark capture (ip.addr==192.168.10.186).  It shows a test application that just responds with 1024 'x' characters, but only 128 are sent.  I stopped it after the first packet, but it would continue with 128 length packets until all 1024 are sent.

I've never run into this before, so I thought I'd start here.


Thanks,
Aaron
« Last Edit: December 18, 2009, 06:28:31 PM by alager »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: why are the packets only 128 bytes long?
« Reply #1 on: December 18, 2009, 07:46:28 PM »
Hi Aaron

Frame 157 shows the board sending a SYN (TCP connection request) to address 76.191.255.220. Here the transmitter is advertising a window size of 256 bytes. The same is true in all subsequent TCP frames sent.

This means that the largest frame that the server can send back is 256 bytes in size. Presumably the PC decides to play safe and only send half of that length.

This size is configured when the connection is attempted:
extern USOCKET fnTCP_Connect(USOCKET TCP_socket, unsigned char *RemoteIP, unsigned short usRemotePort, unsigned short usOurPort, unsigned short usMaxWindow);

If usMaxWindow is 0 it defaults to TCP_MAX_WINDOW_SIZE (about 1400 bytes), otherwise the value which is passed is used.

The parameter is generally left as 0 (default) for simple TCP sockets but can be used to control the reception flow in buffered TCP cases (eg. when building an RS232<->TCP converter it can reflect the remaining space in the UART output buffer and thus ensures flow control operation through the complete system.

In your case check whether this value is being set as expected.

Regards

Mark



Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: why are the packets only 128 bytes long?
« Reply #2 on: December 18, 2009, 11:09:11 PM »
Thanks Mark!
I had TX_BUFFER_SIZE in there for that parameter, which is 256.
I've change it to 0.

Aaron