use of connection timeout in java for socket code example
Example: java socket timeout
Socket socket = new Socket(); // 1000 milliseconds
socket.connect(new InetSocketAddress(ipAddress, port), 1000);
Socket socket = new Socket(); // 1000 milliseconds
socket.connect(new InetSocketAddress(ipAddress, port), 1000);