This example collects data every second for a specified amount of time (10sec in the example), then connects to the server, sends the data, and immediately disconnects from the server.