This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i assign different IP addresses to different Programs
 
Similar Threads
How can i assign different IP addresses to different Programs
How can i assign different IP addresses to different Programs
ip address
DSL and IP address
how to lookup in distributed environment