• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Address already used problem in Java Socket application

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made a small server which accepts a client request. The code is as following.
But i am getting an error message as: Exception in thread "main" java.lang.NullPointerException
at ServerSide.main(ServerSide.java:24)
Not a priveleged Userjava.net.BindException: Address already in use: JVM_Bind



i think the problem is with the port number that i am using, but i tried different port numbers and error still exist, please help,
Regards,
Aman
 
Marshal
Posts: 79945
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And which line is the Exception thrown from?
 
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Port address is already in use...
 
Ammy Singh
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:And which line is the Exception thrown from?


The exception is trown at following:

and



And the console result is as : Not a priveleged Userjava.net.BindException: Address already in use: JVM_Bind
Exception in thread "main" java.lang.NullPointerException
at ServerSide.main(ServerSide.java:22)

 
Ammy Singh
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ram Narayan.M wrote:Port address is already in use...



Ok its fine that the port address is already in use, but how can i find an unused port, and note that i am running the program on a standalone server.
 
Campbell Ritchie
Marshal
Posts: 79945
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult a question for "beginning Java". Moving thread.
 
Ammy Singh
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Too difficult a question for "beginning Java". Moving thread.



ok thank you next time i will take care about which thread to select.
 
The only thing that kept the leeches off of me was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic