• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

How can i assign different IP addresses to different Programs

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Sockets and Internet Protocals forum.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic