wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes How can i assign different IP addresses to different Programs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How can i assign different IP addresses to different Programs" Watch "How can i assign different IP addresses to different Programs" New topic
Author

How can i assign different IP addresses to different Programs

David Nelson
Greenhorn

Joined: Nov 13, 2003
Posts: 22
Hi, all

I'm trying to write some programs to simulate a network environment, how can i assign different IP addresses to different programs.

Once i assign them with different IP addresses, how could Pro1 with IP address 2001:0:0:1::/64 find Pro2 with IP address 2000:0:0:2::/64.

one thing is these programs run on the same machine!

Cheers
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Moving to Sockets and Internet Protocals forum.


GenRocket - Experts at Building Test Data
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Usually a machine has a single IP address. I don't know what happens to a machine with multiple NIC cards. But you can have different port numbers, so you could run one server process listening on 127.0.0.1:8080 and another on 127.0.0.1:8181. Would that do the trick for you?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Stan James:
Usually a machine has a single IP address. I don't know what happens to a machine with multiple NIC cards. But you can have different port numbers, so you could run one server process listening on 127.0.0.1:8080 and another on 127.0.0.1:8181. Would that do the trick for you?


A machine has one address for every interface, NICs usually have one interface each. So you will have one address for each NIC. There are programs that produce Virtual IP Addresses (VIPA), these are mostly available on large IBM servers (OS/390 mainframes). There is an old hack for the Sun OS kernel that will do this.
 
 
subject: How can i assign different IP addresses to different Programs