Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can more than 1 TCP connection be active at the same time between the two ports on two different host? Please answer.

share|improve this question
    
Can you clarify your question or provide an example? –  Colin Feb 1 '12 at 1:51
    
Suppose there is a process on host1 on port X and another process on host2 on port Y. My question is can there be more than 1 TCP connection active at the same time between these ports? –  kuchiku Feb 1 '12 at 3:19

2 Answers 2

up vote 5 down vote accepted

If you are asking if it is possible to a socket open from two client systems to a server where the same source and distention ports happen to be the same, then yes, that is possible.

# connections as seen by server
src_ip       sce_port  dest_ip      dest_port
192.168.1.5  1234      192.168.1.1  1234
192.168.1.4  1234      192.168.1.1  1234

Sockets are identified by (source address + source port + destination address + destination port). The two destination addresses would be different and therefore everything would work fine.

This is unlikely to happen very often in the real world though since the source port is generally picked from a range for ports available for use in outgoing connections.

# connections as seen by server you would most likely see in the real world
src_ip       sce_port  dest_ip      dest_port
192.168.1.5  49345     192.168.1.1  1234
192.168.1.4  51284     192.168.1.1  1234

If you are asking if a single system with a single IP address can open two connections to the same destination address+port from the same source address+port, then the answer is no. When the second instance of the application attempts to bind to that source address+port combo it will get an error.

# cannot happen/invalid, client can't bind
src_ip       sce_port  dest_ip      dest_port
192.168.1.4  1234      192.168.1.1  1234
192.168.1.4  1234      192.168.1.1  1234
share|improve this answer
    
Suppose there is a process on host1 on port X and another process on host2 on port Y. My question is can there be more than 1 TCP connection active at the same time between these ports? –  kuchiku Feb 1 '12 at 3:19

TCP connections are tracked by the port/address tuple:

192.168.101.24:61213 <---> 192.168.105.50:80

That connection is tracked on both sides, and that's what the network stacks use to determine what the actual connection is. Because of that, there can be one and only one connection with that tuple. This is why the originator of the connection uses an 'ephemeral' port for it's half, so it can open up more than one connection to the remote side.

share|improve this answer
    
got it. thank you. –  kuchiku Feb 1 '12 at 3:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.