Home/Support/Support Forum/Is the maximum transmit length in sock_fastwrite() is 2048 bytes?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Is the maximum transmit length in sock_fastwrite() is 2048 bytes?

0 votes
Trying to send more than 2048 bytes with using one sock_fastwrite(). However, only 2048 bytes are sent. These 2048 bytes are broken into 1460 bytes and 588 bytes in TCP.

Tried to set the len to 3000 (the 3rd parameter in sock_fastwrite which specified as "Maximum number of bytes to write to the socket" in Dynamic C TCPIP manual). But still getting the same result.

How can I send data with larger size with sock_fastwrite()?
asked Mar 4 in Rabbit Software by andyfung New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
There's going to be a maximum, and it might change depending on the state of the TCP/IP stack.

As mentioned in the documentation for sock_fastwrite(), it "write up to len bytes". Use the return value to determine how many bytes weren't written, and repeatedly call sock_fastwrite() until you've written them all.

It looks like the limit is based on how much space is available in the write buffer for the socket. If you increase the buffer, you'll be able to write more, but you'll still need to write your code to handle the case where it writes fewer bytes than you requested.
answered Mar 11 by TomCollins Veteran of the Digi Community (1,276 points)
I tried to call sock_fastwrite() multiple times but still seeing only 2048 bytes sent.

Now what I do is to add tcp_tick() after each sock_fastwrite() when doing multiple call. Then I am able to sent bytes more than 2048 bytes.

Is there any different between tcp_tick(socket) and tcp_tick(NULL)?
tcp_tick(socket) is deprecated and you can just call tcp_tick(NULL).  You need those calls to process data in the TCP buffers.
...