• Post Reply Bookmark Topic Watch Topic
  • New Topic

NIO and Windows XP  RSS feed

 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is the first time I am using NIO. I have written an applicaiton using a thread-per-user using the old io stuff. I want to try out NIO and using non-blocking IO for my application. As a starting poin I tried to use the NBTimeServer.java supplied by Sun. I tried running it on Windows XP and it just does not work. It does not accept any connections. I tried running the same code on Solaris and it worked without any problems.
Our code is finally going to be deployed on Windows 2003, so I need to get it working on Windows. Any ideas???

Thanks
Sameer
 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the duplicate post. It gave me an error when I posted the first message, but somehow it successfully posted my message.

Anyway, I have found that if I connect to my own NIO Server using 'localhost', it does not work. If I use my actual IP address. Very bizarre.

Thanks
Sameer
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are only binding to the external IP:

NBTimeServer.java lines 75-77
Print out isa and see what the port is bound to.
If you want to bind to any of the machine's IP addresses, omit the address parameter:

This is a special "wildcard" syntax for an InetSocketAddress specifically for binding. Again, print out isa and you can see the difference.
 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
Thanks for the tip. It was inded bound to one of the two NICs on my laptop.
I changed the code as per your suggestion and it worked with localhost as well.

Thanks
Sameer
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!