Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Reproducing BindException in windows environment  RSS feed

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