]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/support/sockutil.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / support / sockutil.py
1 """
2                      The LLVM Compiler Infrastructure
3
4 This file is distributed under the University of Illinois Open Source
5 License. See LICENSE.TXT for details.
6
7 Helper functions for working with sockets.
8 """
9
10 # Python modules:
11 import io
12 import socket
13
14 # LLDB modules
15 import use_lldb_suite
16
17 def recvall(sock, size):
18     bytes = io.BytesIO()
19     while size > 0:
20         this_result = sock.recv(size)
21         bytes.write(this_result)
22         size -= len(this_result)
23     return bytes.getvalue()