java socket handling timeout 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);