Developing your own protocol is not easy. However, building it on top of TCP / IP simplifies its work. You have indicated that RFCs are protocol rules, and you are correct. However, as a rule, what is a protocol: a set of rules and agreements on how something should be done. The beauty here is that you can specify your own rules. Some of the things you need to consider are the type of data transferred, the length of each part, and the state (if any). HTTP, for example, is a stateless protocol with a header that defines the request or result, and a payload that defines the data to be sent, which can be a form message or an html page.
Thus, you will need to determine the transmitted or received data, the length of the data in bytes, which can be determined by the data type or the expected amount of data. If your protocol has a state - that is, something must first be sent and received before something else - then you need to determine this state. In addition, it is simple network programming (sending and receiving data in your application).
For example, a simple protocol might have the following:
Command 1 Byte Length 4 Bytes Data Length Bytes
The first two define your header, which contains metadata about the data that the other end should be able to read everything. The last would be the actual data. The command, although not required, serves to show that you can force the other side to perform a specific action on the data depending on the byte received. Data lengths are important because the other end needs to know when it reads all the data before it can work on it.
This answer really helps reinforce what I am saying. Hope this helps! fooobar.com/questions/1333716 / ...
source share