Help OSI model layers

Ya’akov

Joined Jan 27, 2019
10,235
Thank you for taking the time to provide such a detailed explanation. My main concern is when faced with multiple options, choosing the one that best fits my specific requirements. Making this decision requires a strong understanding, and that's why I presented my requirements and two options (although I didn't want to overwhelm with choices). I'm more interested in understanding the communication process between servers and clients. I've spent a considerable amount of time researching online, reading books, and various materials to grasp how communication occurs in this context, including the communication protocols used. That's why I shared my requirements and asked for opinions on which option to choose, along with the reasoning behind those choices. I also provided my own perspective on why I might lean towards a particular option. As I mentioned in my initial post, I didn't want a general description, as that information is readily available online. I asked these questions because I find it challenging to comprehend these concepts within the framework of real-world requirements. I'm focusing on practical requirements, especially since I'm considering a smart home system. While some may disagree with my approach, but it works best for me because it allows me to gather diverse opinions and refine my understanding by comparing it with others

I am here getting useful answers on smart home automation IoT project that I wanted to understand

Did you research Thread, Matter, MQTT, or any other IoT specific protocol? The links at the end are what you need to think about, and they include code repos and API references.
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
Did you research Thread, Matter, MQTT, or any other IoT specific protocol? The links at the end are what you need to think about, and they include code repos and API references.
I have re-read the topics many times, but I still don't understand, perhaps I am very dumb person to understand concepts.

Could you share your opinion on the following scenario?

We have two devices, a server, and clients. The client device is connected to a router via Ethernet. The client device reads data from a sensor that works on I2C and sends the data to the server device over HTTP.

How many protocols may be involved in this process? I guess atleast I2C, TCP, IP, and HTTP.

If you were going to write client code, what sequence of protocols would you follow and how would you do error handling?
 

Ya’akov

Joined Jan 27, 2019
10,235
I have re-read the topics many times, but I still don't understand, perhaps I am very dumb person to understand concepts.
I don't think you are a "very dumb person". It is a complicated topic that requires iterative reading because the parts are all interactive.

We have two devices, a server, and clients. The client device is connected to a router via Ethernet. The client device reads data from a sensor that works on I2C and sends the data to the server device over HTTP.

How many protocols may be involved in this process? I guess atleast I2C, TCP, IP, and HTTP.
Why is the number of protocols important?

If you were going to write client code, what sequence of protocols would you follow and how would you do error handling?
I can't make any sense of "what sequence of protocols", what is the importance of sequence?

In any case I wouldn't do that so I don't have any opinion save "that doesn't make any sense". It's not that you couldn't do that—it's just that you aren't doing any of this. Your thought experiments are provokingly useless. It drives you to ask non-questions. Start building something and then you might have real questions which I could have some respect for.

It isn't you that I have a problem with, per se, it's your insistence on theoretical examples and oddball conclusions, rather than putting your hands on something and trying to actually do it which would make the majority of your queries moot.

I am going to withdraw. I sincerely wish you the very best of success at whatever it is you are doing if you attempt it outside your head. Be well.

(Don't forget there are libraries for all of the various protocols, including Thread, Matter, MQTT, and others that practical experience would make more comprehensible to you.)
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
I initially began by studying the OSI layers and understanding the requirements for smart home automation. However, I'm currently facing some confusion when it comes to selecting the appropriate protocol – WebSockets, MQTT, or HTTP. I asked for opinion which one best fit for requirements and why do you think it's best suitable?
 

DC_Kid

Joined Feb 25, 2008
1,242
However, I'm currently facing some confusion when it comes to selecting the appropriate protocol
You might even choose QUIC as the protocol to carry your data.
Really depends on a couple of things. How is your data structured, and can the protocol meet all the needs of your data.

Some protocols are very limited, like DNS.

Some protocols have more functionality, like HTTP vs NTP.

So, it really depends of your data and how that data should be processed.
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
If you need real-time bi-directional communications between devices, then use WebSocket, otherwise use HTTP.
Can you explain in the context of my smart home system example?

By 'real time,' I mean that actions in the smart home system should be taken instantly when needed, without noticeable delay. And 'bidirectional' implies that both the smart home device and the central server should be able to transmit and receive data simultaneously.

For instance, when I want to control the lights in my smart home system, I want the system to respond immediately to my commands (real-time), and I also want to receive updates on the status of the lights (bidirectional) in real-time, allowing for seamless and instant control and feedback.
 

DC_Kid

Joined Feb 25, 2008
1,242
Can you explain in the context of my smart home system example?

By 'real time,' I mean that actions in the smart home system should be taken instantly when needed, without noticeable delay. And 'bidirectional' implies that both the smart home device and the central server should be able to transmit and receive data simultaneously.

For instance, when I want to control the lights in my smart home system, I want the system to respond immediately to my commands (real-time), and I also want to receive updates on the status of the lights (bidirectional) in real-time, allowing for seamless and instant control and feedback.
Full-duplex. In other words, each side can receive and send at the same time.

With HTTP, one side sends data, and then the other side reads the data and then sends back a response.

Example, HTTP browser sends request to GET a page, server side reads the request and then sends back the requested page. This is half-duplex comms.

So, depending on how your application needs to work, you choose a protocol that fits the needs.
 

Thread Starter

MTech1

Joined Feb 15, 2023
181
I'd like to discuss the testing process for ensuring that the firmware in networking setup is functioning correctly at Layer 3 (IP) and Layer 4 (TCP).

To begin, I'd like to confirm my understanding of a couple of initial tests. Firstly, for Layer 3 (IP) validation, we would typically perform a Ping test to ensure that devices can communicate at the network layer. Is that correct?

Secondly, for Layer 4 (TCP) verification, we would initiate TCP connections to remote servers, such as using Telnet or netcat, to ensure that the firmware is facilitating proper Layer 4 communication. Is my understanding accurate regarding the TCP connection test?

Now, could you please elaborate on the other tests that should be performed to validate the firmware's functionality at these network layers? I would greatly appreciate your guidance in this matter.
 

DC_Kid

Joined Feb 25, 2008
1,242
I'd like to discuss the testing process for ensuring that the firmware in networking setup is functioning correctly at Layer 3 (IP) and Layer 4 (TCP).

To begin, I'd like to confirm my understanding of a couple of initial tests. Firstly, for Layer 3 (IP) validation, we would typically perform a Ping test to ensure that devices can communicate at the network layer. Is that correct?

Secondly, for Layer 4 (TCP) verification, we would initiate TCP connections to remote servers, such as using Telnet or netcat, to ensure that the firmware is facilitating proper Layer 4 communication. Is my understanding accurate regarding the TCP connection test?

Now, could you please elaborate on the other tests that should be performed to validate the firmware's functionality at these network layers? I would greatly appreciate your guidance in this matter.
You need to make sure the TCP/IP stack you use and configure will respond to ICMP echo requests.

You don't need any application behind a listening port to test 3-way handshake (full socket). You can simply use a sniffer like Wireshark or PktMon (windows), or tcpdump (nix), to check and see if the 3-way handshake completed.

The bascis of TCP via std deployed TCP/IPv4 stack should be very easy. Most OS's already provide you all that stuff. But I don't really know if you are building your own stuff from ground up, etc. From scratch means you need to have all the right libraries invoked to handle the comms. You can even build your own TCP/IP stack to be more secure than std deployed ones, etc.
 

eetech00

Joined Jun 8, 2013
4,705
To begin, I'd like to confirm my understanding of a couple of initial tests. Firstly, for Layer 3 (IP) validation, we would typically perform a Ping test to ensure that devices can communicate at the network layer. Is that correct?
Ping and Traceroute are the most widely used for this.
Ping checks for basic IP connectivity on local host and LAN.
Traceroute is usually used for troubleshooting IP connectivity beyond the local LAN.
NSlookup is used to troubleshoot DNS name resolution issues.

Secondly, for Layer 4 (TCP) verification, we would initiate TCP connections to remote servers, such as using Telnet or netcat, to ensure that the firmware is facilitating proper Layer 4 communication. Is my understanding accurate regarding the TCP connection test?
Telnet can be used to test IP/TCP connectivity insofar as it uses TCP to establishing a connection with a server.
But it won't tell you if the protocol is working correctly. A packet sniffer, like Wireshark, must be used.

Be aware, these tools are used for trouble shooting finished production units that might have been miss configured when deployed. They do nothing for troubleshooting interprocess communication when developing a IP network stack.
 
Top