Suspends code execution until any pending data has been sent to the server
The maximum time in seconds to wait for pending data to be sent
true if the data has been sent, or
false on any other outcome
This method waits while any pending data is sent to the server. If all the data is sent and acknowledged within the specified timeout period, server.flush() returns
true. Otherwise, ie. if any data is still pending after the timeout period has expired or an error occurred during transmission, it returns
Should server.flush() return
false, you should not take that as a sign that the data has not been or will not be delivered. The method can return
false if, for example, the timeout period is very small. In this case, the flush operation will time out, server.flush() will return
false, yet the data could be ACK’d immediately afterwards.
However, the method has no side effects: should it return
false, it will not close the connection, for example.
This example performs a server.log() shortly before we disconnect from the server. In order to ensure all of the information was sent (and received), we do a server.flush() before disconnecting.