How to share data between threads in this threaded TCPServer?
问题 I'm working on a project which involves sending data over TCP. Using the ThreadedTCPServer I'm able to do that already. The server thread only needs to read incoming strings of data and set the value of variables. Meanwhile I need the main thread to see those variables changing value. Here's my code so far, just modified from the ThreadedTCPServer example: import socket import threading import SocketServer x =0 class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): def handle(self)