0
\$\begingroup\$

I am using M95 GSM Modem for remote data communication with the server. The server-end persons want me to use HTTP data connection.

Another embedded guy has suggested to use sockets and TCP data for communication.

I cannot figure out if both of these are same methods or are they fundamentally different ways to communicate remote data using a GSM modem?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Get the two guys to speak with you seems to be the broader answer. \$\endgroup\$
    – Andy aka
    Jul 31, 2019 at 9:45

2 Answers 2

3
\$\begingroup\$

This evidences how each one of us sees the internet from his point of view. Starting by some basics have a look at this picture:

OSI Model and TCP/IP

Image Attribution : Chunte7 [CC BY-SA 3.0 (full license)]

As you can see the internet can be divided into 4 layers, some times 5 by dividing the network access layer into other two layers, that are in the image on the right. The general structure of any given network is the OSI model which divides any given network into 7 layers. Now please have a look at the following image:

Internet layers

Image Attribution: Microchip devloper help

See the difference? HTTP is an application protocol that runs above the TCP protocol from the transport layer. In fact, in order to create an HTTP connection, you would have to implement an HTTP Client/Server on your system. This is sometimes taken for granted by the sysadmins since a lot of servers are easily deployed and/or implemented in Linux/Windows. When you are dealing with embedded systems this is not always the case since a module might provide an HTTP Client/Server, such as the ESP32 family, or be limited to a TCP/UDP server.

My advice would be to check for the service running on the remote server and implement whatever is compatible with what is already deployed there. If it's a completely new project and you are starting from scratch, look at your embedded system resource to see if it allows an additional layer to be implemented or not.

Keep in mind that implementing a protocol over HTTP would make it easier for back-end developers on the server and would become more scalable and features-rich. On the other hand, it will add a significant overhead for the data you are transferring and would eat a bit more resources from your embedded system.

Having a quick look at your particular module form here in section 11 you have already some TCP/IP commands so there is no need to build it from scratch, on the other hand if you go the HTTP route you would have to implement an HTTP Server/Client compliant application.

\$\endgroup\$
0
1
\$\begingroup\$

HTTP data is transmitted over TCP.

Fundamentally when using "raw" TCP you will have to write some sort of system for framing messages, deciding their boundaries, handling transmission and server errors. HTTP gives you a standard way of doing that, but there are a lot of other standard protocols that you could use as well.

Using HTTP will mean more software on the device and less custom software on the server. It's a lot easier for the server software developers. If you can use a library, or the modem's HTTP commands, it will be easy on the device side as well.

If you care about the precise cost per byte and your needs are very simple, TCP might be better.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ HTTP indeed uses TCP. However, there are a variety of strategies for how exactly it manages the underlying TCP connection(s) which can end up needing a fair amount of attention in an embedded context. On real-world networks it is also often practically necessary to insert an SSL layer in between the TCP and the HTTP. And then there's the whole websocket idea... \$\endgroup\$ Jul 31, 2019 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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