1

I'm trying to understand the networking abstraction layers.

I think I understand that TCP is at the network layer, and HTTP is at the application layer. Thus, HTTP may be done 'over' TCP.

However, I can do 'socket' programming as well, which for instance on a server allows listening and responding on certain sockets.

In such a situation, I could respond with XML on a certain socket, not defining anything specifically on the application layer. I'm just passing the XML as ASCII text in byte array form. Would the XML response be considered not a part of the application layer, or just a 'custom' protocol on the application layer?

5
  • TCP is layer 4, the transport layer. IPv4 or IPv6 work at layer 3, the network layer. – penguin359 Apr 10 '18 at 0:21
  • @penguin359 whoops yes you are absolutely correct – Aaron Thomas Apr 10 '18 at 0:56
  • Whatever application you built or used to “respond with XML” would operate at the application layer. So all the layers are still there. – Appleoddity Apr 10 '18 at 3:15
  • @Appleoddity just trying to wrap my mind around this - if the application is doing socket programming does that mean the application is not operating at the transport layer? – Aaron Thomas Apr 10 '18 at 12:55
  • Your application will have a defined (custom) protocol that defines how it sends/receives the XML. This is at the application layer, similar to HTTP. Your XML is sent over a tcp or udp socket which operates at layer 4. TCP/UDP will use IP (layer 3) to transfer data between hosts. Your computer will use Ethernet (layer 2) to talk across a local network. The network card will use a cable (layer 1) to get data from one device to another. Each layer provides a specific function and the layers above need all those below in order to work. – USD Matt Apr 10 '18 at 14:02
0

TCP is at the TRANSPORT layer, layer 4. HTTP is at the APPLICATION layer, layer 7.

enter image description here The 7 Layers of the OSI Model

In the OSI model, the upper layers (5-7) and the lower layers (1-4) have specific roles. Often times, the upper layers are combined in to 1 layer, and therefore the OSI model becomes a 5 layer TCP model. The lower layers provide the network connectivity and reliability. The upper layer(s) provide application services to users and programs. Everything you see or touch, as an application or developer, is somewhere in the upper layers.

What you are calling "sockets programming" is really no different than what any application does that needs to communicate on a network. A socket can't be opened unless an upper layer application requests it to happen. It is requesting that the operating system create a particular network socket, and send or receive data. Therefore, even a basic application that you create to send or receive data over a socket is considered an upper layer process.

It's debatable if your XML application operates at Layer 5, 6 or 7 because it really depends on what you do with the data from there. The request to open a socket technically happens at Layer 5 (Then the socket is opened and maintained in the lower layers). But, depending on what data you send or receive, and what you do with that data, you will begin operating at Layer 6 or 7. Because of this ambiguity, it's much easier to combine the upper layers in to a single layer, because it really makes little difference from an application point of view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.