• Post Reply Bookmark Topic Watch Topic
  • New Topic

SocketTimeoutException: Accept timed out.  RSS feed

 
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
Saloon Keeper
Posts: 6980
110
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!