So we've looked at Layers 1, 2 and 3 which are the most important ones that you'll be looking at when designing your network, but let's run through the other layers as well because they're useful to understand how the whole network hangs together in terms of what you use it for. So Layer 4 in the OSI Model is the transport layer and what Layer 4 adds is a way of identifying individual processes on a machine. So an ip address will identify a machine but a port number will identify a process that's running on the machine. So that might be your web browser or your web server, which bit of software you need to deliver this traffic to. That's the fundamental service that transport layer provides. There are other services that some transport layers provide as well. So some transport layers will provide reliable delivery, that means they will give you the ability to send streams of data of unlimited size so it will you're not limited to how much fits into a single datagram. They will break the traffic up into multiple datagrams and reassemble it at the other end. They will provide error correction and retransmission so that if data is lost then it was automatically retransmitted. They'll ensure that if packets are delivered out of order that the application sees them in the correct order and provide flow control so that something that's receiving data doesn't get overwhelmed by incoming data. It can control the rate at which the sender sends to it. So those are features that may exist at Layer 4 but they might not. So you could therefore just have an unreliable datagram transport which essentially takes a piece of data and puts it inside a Layer 3 datagram and sends it and it may or may not get delivered successfully. So examples of Layer 4: here's the first example UDP. The user datagram protocol and this is one of these protocols that doesn't provide any delivery guarantees. All it does is it adds a few extra fields inside the datagram. You have a source port number, destination port number, a length and a checksum. So it will detect transmission errors and then the payload. So the port numbers are 16 bits and some of those ports, the ports below 1024, they're called well-known ports and they're assigned to applications. There's a registry at IANA which will track official allocations for what these port numbers are used for. So example UDP port 53 is supposed to be used for DNS. Port numbers above 1024 are called ephemeral ports and those are ones that are chosen dynamically by the client. So whenever you send a packet to a DNS server the destination port number will be 53 but the source port number will be some port number that you choose, that your client application, that sending will choose or the operating system will choose on its behalf so that when the response comes back that will become the destination port for the response and the destination message can be delivered back to the right application. So more sophisticated Layer 4 protocol is TCP, Transmission Control Protocol, and this one also has source and destination port numbers, same 16 bits again. Example well known port 80 on tcp is for http but it adds a bunch of other fields here so that the header for tcp is much bigger and it adds features like reliable transmission. So it has a sequence number and acknowledgement numbers in the packets that allow it to keep track of how the packets relate to each other in a stream and can make sure that they are assembled together in the right order and if they need to be re-transmitted you know which ones to re-transmit. There is flow control which is handled by the window mechanism. The window says how much data the other side is allowed to send before the receiver's buffer gets full. So the receiver will buffer up that amount of data. The transmitter will stop until the receiver has consumed some data from the buffer so that allows the receiver to control the flow of data back by the transmitter. There are flags that control the session so syn and ack are used in setting up a TCP session and fin and reset are used in closing it down and in fact the TCP header is a variable length. So it's possible to extend the header by turning on options. So the field that says how many option bytes are there that allows extra features to be added to TCP over time and this has been done. A number of new features have been added to TCP in this way.

© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.

Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.