This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reproducing BindException in windows environment

 
Elhanan Maayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi...

for a while now we are stubmling on a strange bug which seems to only happen in linux, which is a bindException, a socket server fails when tries to bind to a port on a linux machine, but does not do so in a windows. both jvm's are of sun, same version same build. (1.6.0_25)

so what's the difference?
 
Henry Wong
author
Marshal
Pie
Posts: 20998
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elhanan Maayan wrote:hi...

for a while now we are stubmling on a strange bug which seems to only happen in linux, which is a bindException, a socket server fails when tries to bind to a port on a linux machine, but does not do so in a windows. both jvm's are of sun, same version same build. (1.6.0_25)

so what's the difference?



Well, there are two obvious differences. First, one is on a linux machine and the other on a windows machine. These are two different OSes, which have different services -- so a port that is free on one machine may not be on the other machine (due to service configurations).

And second, the sockopts are different. If the bind error is caused by an application bounce, one possibility is the TCP timeout -- it may be a good idea to set the TCP NODELAY to allow better reuse of the ports.

Henry
 
Elhanan Maayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the ports were not taken , this is because the application DID manage to bind to the port initially, i've found out, if i wait 10 ms in linux then i can bind to the port, if i try to close and open and it fails (but not always)

and reuse property was used.
 
Henry Wong
author
Marshal
Pie
Posts: 20998
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elhanan Maayan wrote:the ports were not taken , this is because the application DID manage to bind to the port initially, i've found out, if i wait 10 ms in linux then i can bind to the port, if i try to close and open and it fails (but not always)

and reuse property was used.



The purpose of TCP_NODELAY is to allow the bounce without having to wait for the socket timeout. So, if reuse was set properly, it should work.

Henry
 
Elhanan Maayan
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe it allows it in windows, but in linux it's different?
 
Henry Wong
author
Marshal
Pie
Posts: 20998
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elhanan Maayan wrote:maybe it allows it in windows, but in linux it's different?


I use it all the time -- with both Linux and Windows -- it works fine.

Henry
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic