This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have the following piece of code
InetAddress addr = InetAddress.getByName(server.getHost());
int port = Integer.parseInt(server.getPort());
SocketAddress sockaddr = new InetSocketAddress(addr, port);
socket = new Socket();
When I run it as standalone java application(jar) trying to connect to the server(down). It throws IO Exception with message "connect timed out" . The exception is thrown after 5 secs.
When the application(jar) is loaded from jvm.dll(native code) trying to connect to the server(down). It throws IOException with message "Connection refused: connect"
The issue with this is exception is thrown immediately within a second.
The whole logic is based on the timeout parameter. Does anyone have idea what could be the reason of different behavior Or How to resolve this issue ?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Socket connect timed out and connection refuse