Ethernet flush

Anyone have any idea of how the stream flush call blocks ? I'm relatively new to Arduino, so before I start digging into library code I thougth I'd see if anyone else has seen a problem like I am having. Basically, my sketch opens a socket connection to a PC-based server application on a specific event, sends some data, and then closes as such:

client.connect
client.write
client.flush
client.close
... repeat on next event

It appears that the flush command is not blocking because the close takes place prior to end of the stream being received on the other side. This results in a file descriptor leak on the other side. If I inject a 100ms delay between the flush and the close in the code above, the problem goes away.

This is a relativeley minor problem, as I can just check for open file descriptors within the application on the other side, however, it is still bugging me as to whether or not my Arduino code is missing something.

Thanks for any responses.
Conrad

Client.flush() is empty as defined in Print.h. It might be defined in the specific network client implementation but you didn't tell us what you're using.

Usually you would wait for a server response before closing the channel, but that depends on the protocol used (which you also didn't tell us).

BTW, the Ethernet library sends every byte immediately so a flush is not needed usually. Are you sure your server is not expecting the client to wait for an answer?

some reading about flush