Thread: Port termination

  1. #1
    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
    Ireland
    Posts
    8,446
    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.
    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
    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
    Ireland
    Posts
    8,446
    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
    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
    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,895
    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
    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,895
    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
    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, 08: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, 04:59 PM