Python Sockets - creating a message format

I created a Python server that various clients can connect to, and I need to install a predefined series of messages from clients to the server. For example, the client passes the name to the server the first time it connects.

I was wondering what is the best way to approach this? How do I create a simple protocol for their communication?

Should messages start with a specific set of bytes in order to mark them as part of this protocol and then contain some kind of message identifier? Any suggestions or further reading are appreciated.

+3
source share
4 answers

-, , , ( ) . , , , . python re. , struct .

-, , - (, , , ), , , - FSM .

-, , , , IETF

, - , , Python Twisted

+1

JSON: " " JSON. HTTP: " " (, ) JSON .

JSON HTTP:

  • ( ..)
  • /
  • -
  • ( )

, , . , ( ) .

+2

, , . ? , , ? ? , ? RPC, ?

+1

Source: https://habr.com/ru/post/1728041/


All Articles