Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NIO Socket - connection problem

biju thomas
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the new NIO (of Java 1.4) for making a socket connection to a server. I do the following:
* Create a Selector (selector)
* Open a SocketChannel (sc)
* Connect to the Server using sc.connect()
* and if it returns false I register it with the selector for OP_CONNECT
* and when I recieve the CONNECT message, I use the sc.finishConnect()
This works fine, when the Server is running. But if the server is started after starting the client program, the program never recieves the OP_CONNECT message.
Does anyone know how to work arround this problem ?

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic