Added parameter to set the max number of sockets.