Need expert help for sock_write in tcp

Problem : Data not always send out, sometime need to send out second packet then only the first packet will get send out together.

Program description : I am writing a tcp client that can send out data to laptop program using WiFi interface on Rabbit 5600W.

this is the line i use.

len = sock_write (&SOCKET, packet, strlen(packet));

It there I missed anything?

or anyone have a good tcp client code example?

According to the documentation, the sock_write function busy waits and should either return the number of bytes written or -1. Have you checked the return value?

Secondly, have you tried looking at the network traffic with Wireshark to see what is being sent on the wire? Is it a case that the Rabbit is sending the two messages together or is it a case that the software reading the data at the socket on the PC is not reading the first packet until the second one arrives?


sock_write return length value is correct.

I will check about wireshark later.

Thx Petermcs for reply

You could also look at using sock_flush after the write to make sure the data is pushed out.


I had used sock_flush but I check the transmitter buffer using sock_tbused and the return value is not zero…

Do you know what is the reason behind?