# nopoll_conn_flush_writes

Definition: | include nopoll.e integer bytes_written = nopoll_conn_flush_writes(atom conn, integer timeout, integer previous_result)
Description: | Ready to use function that checks for pending write operations and flush them waiting until they are done or until the timeout provided by the user is reached. This function uses nopoll_conn_pending_write_bytes and nopoll_conn_complete_pending_write to check and complete pending write operations. Because writing pending bytes is a common operation, this function is provided as a ready to use function to call after a write operation (for example nopoll_conn_send_text). conn: The connection where pending bytes must be written. timeout: Timeout in microseconds to limit the flush operation. previous_result: The number of bytes read before this call. The value received on this function will be added to the result, checking first it contains a value higher than 0. This is an option to clarify the interface. If you don’t have the value to be passed to this function at the time needed, just pass 0. Returns: Bytes that were written. If no pending bytes must be written, the function returns 0. The function returns bytes written or bytes written plus if previous_result is > 0.
See Also: | nopoll_conn_complete_pending_write, nopoll_conn_pending_write_bytes, nopoll_sleep