• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i assign different IP addresses to different Programs

 
David Nelson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Sockets and Internet Protocals forum.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic