May 2019
Intermediate to advanced
542 pages
13h 37m
English
While UDP sockets work with datagrams, TCP sockets work with data streams. As the name implies, data streams involve a flow of data rather than discrete units. TCP transmissions are sent as a stream of network packets that may or may not arrive in the correct order, and it's up to the receiver to correctly reassemble the data received. To make this process easier, we can wrap our socket in a QtCore.QDataStream object, which provides a generic interface for reading and writing data from file-like sources.
Let's begin our method like this:
def process_datastream(self): for socket in self.connections: self.datastream = qtc.QDataStream(socket) if not socket.bytesAvailable(): continue
We're iterating through the connected ...
Read now
Unlock full access