Try these questions to test your knowledge from this chapter:
- You are designing an application that will emit a status message to the local network, which you will monitor with administrator tools. What kind of socket object would be a good choice?
- Your GUI class has a QTcpSocket object called self.socket. You've connected its readyRead signal to the following method, but it's not working. What's happening, and how can you fix it?
def on_ready_read(self):
while self.socket.hasPendingDatagrams():
self.process_data(self.socket.readDatagram())
- Use QTcpServer to implement a simple service that listens on port 8080 and prints any requests received. Make it reply to the client with a byte string of your choice.
- You're creating a download function for your application to retrieve a large data file for import into your...