I am trying to execute the following Java code on an Intel Based Linux machine (Custom Minimal Linux version: Linux 2.6.18). Socket creation is taking too long (~ 3mins). When I run the Top command in Linux, Its showing me that my Java process is in Sleep. Can some one tell me whats going on with this?
Java Version: 1.6.0_24
try{
System.out.println("Creating a Socket at: " + new Date());
s = new Socket(hostname, p);
System.out.println("Socket creation complete at: " + new Date());
s.close();
}
UPDATE: Tested with Java 1.7 (1.7.0_01) and it works fine. Whole program runs under 5 seconds. Socket creation returns almost instantly.
telnet <hostname> <port>
take from the shell prompt (with the same<hostname>
and<port>
as your code)? – NPE Oct 27 '11 at 14:41