api-sample: use non blocking sockets