• Post Reply Bookmark Topic Watch Topic
  • New Topic

SocketTimeoutException: Accept timed out.

 
venky ram
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, The following bit of code throws java.net.SocketTimeoutException: Accept timed out.

ServerSocket serverSocket = new ServerSocket(0, 1, InetAddress.getLocalHost()); serverSocket.setSoTimeout(6000);
serverSocket.accept();

I have tried changing everything i can in creating a serversocket but the error remains the same. Please guide me in what I' missing here, if any.
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you are using setSoTimeout(6000). Why are you using this code if you don't expect a timeout to happen?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!