-
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
-
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.
-
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? "
-
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
-
Hmm.... Ok. I have become stale. Think I'll pick up Network programming again :D. 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.
-
What is it that you want to achieve? You might want to look for multicasting.
-
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
-
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.
-
Thanks. Got it sorted now.