Main loop as sleep function
Custom number of ports