LAYER4 - Transport control protocols, there are others, apart from Transmisiion control protocol, to name just two...
AEP - Apple echo talk
FCP - Fibre channel protocol
https://www.youtube.com/watch?v=5o8CwafCxnU
This section focuses on the most common and that is the one adopted for use on the internet and most LANs - TCPIP Transmission control protocol Internet protocol.
TCPIP operates at the top three layers, bottom two are ETHERNET, a totally seperate protocol.
Application at send end send 'message' to transport layer which it needs sending to the recipient. The message is translated to the transport layer to become a transport layer message or packet, to be sent to the recipient.
Various protocols operate within the umbrella of TCP/IP:
APPLICATION LAYER
TRANSPORT LAYER
NETWORK LAYER
When the application layer passes data to be sent in a message, to the transport layer, the responsibility is then passed to the transport layer for that message to be sent to the recipient. The transport layer splits the message into sufficient packets to be sent accross the chosen ethernet network and wraps a header of meta data onto each packet, which describes many things about the data. Aswell as sending, transport layer is also responsible for recieving data and sending it back to the application layer to appropriate program. HTTP normally uses port 80 as an example so the TCP header data will normally include the port number when sent so that TCP will return it to the same port number. Each packet also has an assembly sequence number so that the receiving computer is able to reassemble the data. TCP is CONNECTION orientated which means it will first establish a readiness to send with receiver, before sending the stream of packets over the network, each packet received, then an acknowledgement packet is sent back to the sender. If any don't arrive then packets can be resent.
The netowrk layer is responsible for routing the packets across smaller and larger distances, normally across the internet. Transport layer hands the packet to network layer, IP in this case, and wraps further meta data onto the packet header which amongst other things, identifies the sender and reciever IP address which it will find by resolving URL hostname to an IP, using DNS server often. Network layer has now made a 'datagram' which is then passed to the DATA layer to send for the long or shorter haul destination via the layer 1 and/or fibre links. DATALINK layer assembles packets into 'FRAMES' before sending across the links. IP acts as a connectionless service so wont expect acknowledgement of readiness first, if confirmation packets are received it will pass the packet straight back to transport layer without examining it.
Once a frame sent by the data-lin layer arrives at a router, then the frame is sent back to the network layer as datagrams, which the router then decides how to send on, using a routing table (relevant to that router). Routing tables are dynamic and created by the router itself so any line breaks, then the router will update the table to choose an alternate route. Once a next hop is chosen for the packet, it is past back to the datalink layer and from the the frame is reassembled before being sent onto the next router. If the frame arrives at a switch then it is just passed onwards by the switch to the next hop as the switch is part of datalink layer and complex routing decisions are not normally made by the switch.