-1

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

kuchiku
  • 3
  • 1
  • Can you clarify your question or provide an example? – Colin Feb 01 '12 at 01: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 01 '12 at 03:19

2 Answers2

5

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
Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • 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 01 '12 at 03:19
2

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.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300