12

Some people said that there are 4 tuples in a connection

client IP address, client port number, server IP address, server port number

Some said that there are 5

client IP address, client port number, server IP address, server port number, protocol

Which one is correct ?

Community
  • 1
  • 1
onmyway133
  • 45,645
  • 31
  • 257
  • 263

2 Answers2

24

You've misunderstood the terminology. A TCP connection is identified by a 5-tuple. That means one tuple, with 5 elements. The five elements are:

  1. Protocol. This is often omitted as it is understood that we are talking about TCP, which leaves 4.
  2. Source IP address.
  3. Source port.
  4. Target IP address.
  5. Target port.
user207421
  • 305,947
  • 44
  • 307
  • 483
  • doesn't that a socket identify a connection ? – onmyway133 Apr 02 '13 at 12:18
  • @onmyway133 A TCP socket is an endpoint of a connection. It also has the 5-tuple associated with it, of course. – user207421 Feb 11 '21 at 00:47
  • [RFC 9143](https://www.rfc-editor.org/rfc/rfc9143.html#name-terminology) describes a _transport_ as a 5-tuple as well: `A collection of the following values: source address, source port, destination address, destination port, and transport-layer protocol.` – JimB Aug 19 '23 at 22:34
-1

However, in a ICMP connection, it's identified by a 3-tuple :

1-Source IP address 2-Destination IP address 3-ICMP Identifier

Refer to : RFC 6146