(sock)
| 219 | |
| 220 | def tcp_server(self, sock): |
| 221 | def run(sock): |
| 222 | with sock: |
| 223 | conn, _ = sock.accept() |
| 224 | conn.settimeout(self.timeout) |
| 225 | with conn, open(TESTFN2, 'wb') as f: |
| 226 | event.wait(self.timeout) |
| 227 | while True: |
| 228 | chunk = conn.recv(65536) |
| 229 | if not chunk: |
| 230 | return |
| 231 | f.write(chunk) |
| 232 | |
| 233 | event = threading.Event() |
| 234 | sock.settimeout(self.timeout) |