(sock, timeout=0.5)
| 5 | |
| 6 | |
| 7 | def consume_socket_content(sock, timeout=0.5): |
| 8 | chunks = 65536 |
| 9 | content = bclass="st">"" |
| 10 | |
| 11 | while True: |
| 12 | more_to_read = select.select([sock], [], [], timeout)[0] |
| 13 | if not more_to_read: |
| 14 | break |
| 15 | |
| 16 | new_content = sock.recv(chunks) |
| 17 | if not new_content: |
| 18 | break |
| 19 | |
| 20 | content += new_content |
| 21 | |
| 22 | return content |
| 23 | |
| 24 | |
| 25 | class Server(threading.Thread): |
no outgoing calls