Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can i bind my server socket to the ip address  RSS feed

 
Harish Kashyap
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • 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
 
Ravi Verma
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!