• 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

how can i bind my server socket to the ip address

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
can anyone help me
i want to bind my server socket to one of the 3 ip addresses of my system.
my system lies on 3 different networks and i want my server socket to listen to one of the three networks.
if i specify localhost, it binds to 127.0.0.1
i can't bind host name to one ip address at system level
is there any way to specify an ip address while creating server socket.
I think InetAddress class is not complete it should allow to specify ip address in string format like in C.
please help me
thanx
harish
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try like this Don't the IPAddress while creating ServerSocket just use new ServerSocket(port), It works irrespective of any network u connected.
chalo give a try
Ravi

Originally posted by Harish Kashyap:
hi all,
can anyone help me
i want to bind my server socket to one of the 3 ip addresses of my system.
my system lies on 3 different networks and i want my server socket to listen to one of the three networks.
if i specify localhost, it binds to 127.0.0.1
i can't bind host name to one ip address at system level
is there any way to specify an ip address while creating server socket.
I think InetAddress class is not complete it should allow to specify ip address in string format like in C.
please help me
thanx
harish



------------------
Ravi
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic