0

Recently I was reading the AMQP protocol specification from the official website, however, because this is my first protocol that I am trying to study in depth so couple of generic questions about protocols pop up in my head that I would like to find an answer.

  • How does a protocol contain type system, methods, constructors and etc? Where are these things defined?
  • How does my OS system know which TCP port is for AMQP and other protocols based on TCP/IP? Is there some sort of mapping in the OS?
  • How does my OS even know about protocol? Do I install something without knowing?

1 Answer 1

2
  • How does a protocol contain type system, methods, constructors and etc? Where are these things defined?

All of those need to be defined in the protocol specification itself. Not all protocols have a type system, methods or constructors and there is no general consensus what they should look like (especially the type system) in the context of communication protocols.

  • How does my OS system knows which tcp port is for AMQP and other protocols based on TCP/IP? Is there some sort of mapping in the OS?

In principle, every protocol can be bound to any existing port. There is just a convention that certain protocols can be reached on a specific port, like port 80 for the HTTP protocol.
The program that provides a server for a particular protocol (such as HTTP, AMQP or a protocol that sits on top of that) typically tells the OS on which port it wants to receive the protocol data.

  • How does my OS even know about protocol? Do I install something without knowing?

This depends on the protocol in question. Some protocols (like IP, TCP and UDP) are seen as so basic and ubiquitous that every OS comes by default with an implementation for them.
Some other protocols (like HTTP or SMTP) are typically implemented in user-space programs and are not known to the OS.
Still other protocols that are meant to be used as building blocks for creating other protocols on top of might be provided as libraries that you need to install separately (and might become a default installed part of the OS if they become popular enough). AMQP seems to be in that latter category.

4
  • What do you mean defined? Let me be more precise. Say each data is transformed into bits then packets, segments and etc, and at some point while using AMQP smallest units of data are called frames and these frames are sequence of bytes and each part of this sequence is something special (for AMQP there is part where method is specified) so a data travels the network with first frame and first couple of bytes named "Open" in order to make a connection. So something in my computer knows how to deal with this specific sequence of bytes? Right? Or am I wrong or don't get it at all?
    – kuskmen
    Jun 21, 2017 at 17:46
  • 1
    Just a note. Protocolos are not necessarily code. A protocol can be just a set of defined rules that describe a process. For instance, AMQP. Then some vendors implement the protocol according to the rules. For instance RabbitMQ. And later the same vendor enhance the implementation with extra features
    – Laiv
    Jun 21, 2017 at 17:51
  • 1
    @kuskmen: You are right. The part of your computer that knows that those bytes mean "Open" is the implementation of the AMQP protocol. The document defining the AMQP protocol tells us which byte sequence means "Open". That is also what I meant with defined. Jun 21, 2017 at 17:53
  • So if I dive more, I will find out that RabbitMQ for instance are using this "open" byte sequence to open connection and this is their implementation, if I check ZeroMQ it might be different , but the protocol defines only how it should behave, but after all there is implementation, for instance, for opening connections that RabbitMQ used or developed? Lets say they create TCP sockets in some language but this language use some internal system calls to create TCP socket and so on maybe going down to the kernel itself?
    – kuskmen
    Jun 21, 2017 at 17:57

Your Answer

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

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