Port termination

This is a discussion on Port termination within the Tech Board forums, part of the Community Boards category; Is it possible to terminate 2 servers on 2 different IPs (2 NICs on the same machine i.e. multihomed) at ...

  1. #1
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Port termination

    Is it possible to terminate 2 servers on 2 different IPs (2 NICs on the same machine i.e. multihomed) at the same port. My friend says it's possible. I'm almost sure it's not. Or is it the other way round? (can't terminate an IP to two different ports)
    Reason being I need IIS and tomcat to listen on the same port but tomcat's responding to both IPs on the same port where as IIS is sorted (So I guess this mean it can be done? ) .
    Thanks
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    It's not possible to do it with a single connection. TCP/IP connections are identified by the port numbers used at both ends. Not just the server side port.
    Last edited by Mario F.; 09-27-2006 at 08:39 AM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    but the physical hardware has 2 NICs both with different address. What I'm asking is "can both IP adresses be terminated at the same port on the machine given that each NIC has a different IP? "
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,412
    From the client side, one server machine with 2 NICS and two server machines with one NIC is exactly the same. All the client sees is an address and a port. It establishes the connection to that address : port and that's it.

    Terminating a service or whatever is done through that connection and it affects that port and address only.

    A port doesn't exist by itself. It exists as part of an address. It's not something that is detached from the notion of an address. In a simplistic view, a NIC owns its ports. You don't establish a connection to a port only. You establish a connection to an address : port
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Hmm.... Ok. I have become stale. Think I'll pick up Network programming again . But it should be possible to achieve this feat if the OS/programs are virtualised right? After all the OS will not be globally monopolising port resource.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    What is it that you want to achieve? You might want to look for multicasting.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    My friend just needs Tomcat to respond to just 1 of the IP addresses on the same port as the other (which is tied to IIS) on the same machine. IIS works fine and only responds to 1 IP. Tomcat, it seems is behaving badly and responding to both IP addresses
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    So it binds to all addresses. That's something completely different from what you first described.

    You need to set the address attribute on the Connector element in the server.xml of Tomcat to only the IP you want Tomcat to bind to.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Thanks. Got it sorted now.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM
  4. Basic port scanner code .. pls help ???
    By intruder in forum C Programming
    Replies: 18
    Last Post: 03-13-2003, 07:47 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 03:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21