Five pieces of information make up each unique bidirectional TCP/IP connection. This 5 tuple must be unique for each connection to allow data to go to and from the right places.
The 5 tuple consists of: protocol type, local address, local port, remote address, remote port.
The protocol type for a TCP/IP connection is TCP/IP.
The local address and remote addresses are the 4 byte address usually written as nnn.nnn.nnn.nnn.
The local and remote ports can be fixed number based on the type of communication, or it may be assigned from unused ports.
So how does this all work?
Let's say my computer wants to talk to K5's web server.
My machine knows its own IP address and looks up K5's IP address using DNS. Assume my IP address is 62.1.1.10 and K5's is 237.43.22.11.
The IP protocol for http is TCP. My web browser knows this.
My web browser also knows to use remote port 80 for http connections. Server listen on this port for incoming connections.
My machine initiates the connection and K5 listens and waits for connections.
So I have four items of the five tuple. To get the last item, my machine will assign a port number out of the list of unused ports that don't correspond to well known services. Say it chooses 23785.
In that case the 5 tuple (protocol, Local Address, Local Port, Remote Address, Remote Port) will be: (TCP, 62.1.1.10, 23785, 237.43.22.11, 80).
While it is active, this 5 tuple will be unique on the entire Internet. Once the connection is no longer used, a new connection could be made using the same 5 tuple.
It doesn't matter if one used Berkeley Sockets, WinSock, or other method to create a TCP/IP connection, they all need those items.