summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/support/sockutil.py
blob: 789deed8017a9479da59e7cc71b349b5588b0fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
                     The LLVM Compiler Infrastructure

This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.

Helper functions for working with sockets.
"""

# Python modules:
import io
import socket

# LLDB modules
import use_lldb_suite


def recvall(sock, size):
    bytes = io.BytesIO()
    while size > 0:
        this_result = sock.recv(size)
        bytes.write(this_result)
        size -= len(this_result)
    return bytes.getvalue()