SyntaxFix
Write A Post
Hire A Developer
Questions
You could use the following solution:
SocketAddress sockaddr = new InetSocketAddress(ip, port); // Create your socket Socket socket = new Socket(); // Connect with 10 s timeout socket.connect(sockaddr, 10000);
Hope it helps!