Improved Sockets available port resolution.