• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

all ports are used-adress already in use

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i am trying to create a serversocket and run the following error is coming:-

java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at ServerDemo.main(ServerDemo.java:11)

No matter whatever port number i give the samething is happenning.
This is how i am creating my serversocket:-
ServerSocket s= new ServerSocket(4242);
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is very nearly impossible for a computer to have every single port in use. It is theoretically possible, but so impractical and improbable as to at least be considered, if not truely be, impossible.

I have the feeling that you are attempting to bind the same port twice. Whether this is because of a loop, multiple threads, or whatever, I don't know. But, I would say to take a close look at your code, and debug it, to find out why you are attempting to open the port twice.

It is probably only an honest mistake, but I can almost guarantee (about 99% sure) that this is what is happening.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
many times when you are not running a java program directly , like for example using an IDE .
Sometimes you might not see any activity in the IDE , but the process might be running in the background.Try using an process explorer to see if the program is running or not.If you find the program running , then kill the program and then run your server again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic