Kawasaki error: E4026 TCPIP No buffer space

After about 10 minutes of continuous use of my robot program I got the following error: “E4026 TCPIP No buffer space”. I’ve added a picture of the error and the part of the program which gives the error below. At the moment, the only thing I can think of is that at the end of this program the RETURN statement is missing. Has someone experience with this buffer error and can help me with it?

.PROGRAM send(.ret,.$data) ;Communication sending data
$send_buf[1] = .$data
buf_n = 1
.ret = 1
TCP_SEND sret,sock_id,$send_buf[1],buf_n,tout
IF sret < 0 THEN
	.ret = -1
	PRINT "TCP_SEND error in SEND",sret
ELSE
	PRINT "TCP_SEND OK in SEND",sret
END
.END

I have never encountered this error before but maybe you can try the following things:

Are you sure all the data you send is also received on the receiver side?

Also is the data you send always 1-Byte at a time?

You could try to make $send_buf[1] a local variable. I’m not sure how this AS language works but when in c/c++ a function is called the local variables are placed into the program memory. When the Program ends the assigned memory for the local variables is cleared. If this is also the case in AS it means the .$send_buf[1] is cleared so there won’t be any data left that can overflow the buffer.(not sure if $send_buf[1] is the bad guy in this code but you could try).

And for good measure, change the 1 in $send_buf[1] to a 0 since arrays always start at place 0 and not 1 (shouldn’t really make a difference I think).

Yes, all the data is received at the receiving end.

I’m not sure but probably the data is send multiple bytes at a time. But normally that doesn’t give any problems.

Making the send buffer a local variable unfortunately didn’t solve the problem :frowning:.

The reason for me to start the arrays with 1 is because the TCP example also has it that way. Changing them to 0 didn’t make any difference.

Are there other suggestions?

This error might have had something to do with closing the socket too fast. Can you confirm this Lloyd so we can close the topic?

Edit:
@4lloyd is this problem solved? And do you know the exact cause of the problem?