Changed to support connecting to specific sockets