Sending data between server and client in twisted

I am trying to transfer data between server and client implemented using twisted. As far as I know, using self.transport.write ([data]) will only work if the data is a string. Is there any other way to send an object of a different type? Thank!

+3
source share
1 answer

Sockets carry bytes. This is the only thing they carry. Any two TCP connection endpoints can only transmit bytes to each other.

Bytes are not the most useful data structure for each form of communication. Thus, in addition to this byte transport, we invent formatting and interpretation schemes for bytes. These are the protocols.

Twisted , almsot twisted.internet.protocol.Protocol, .

-, , , . , twisted.protocols.basic.NetstringReceiver netstring. , , . , , - , .

, , dataReceived , , . NetstringReceiver , , stringReceived Python str.

, NetstringReceiver. , twisted.protocols.ftp FTP. FTP - , ( ). twisted.mail.pop3 POP3, .

, , , , . , , , , , ( ). , . " ", , , , , , , , , ..

, , . , .

, Python, , Twisted Spread .

- , , , , XML-RPC (Twisted How-To) .

, , XML-RPC, , AMP .

.:)

+7

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


All Articles