• Post Reply Bookmark Topic Watch Topic
  • New Topic

NIO Socket - connection problem

 
biju thomas
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 ?

Thanks,
biju.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!