MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / read_msg

Function read_msg

packages/ibkr/ref/source/pythonclient/ibapi/comm.py:77–88  ·  view source on GitHub ↗

first the size prefix and then the corresponding msg payload

(buf: bytes)

Source from the content-addressed store, hash-verified

75
76
77def read_msg(buf: bytes) -> tuple:
78 """first the size prefix and then the corresponding msg payload"""
79
80 if len(buf) < 4:
81 return (0, "", buf)
82 size = struct.unpack("!I", buf[0:4])[0]
83 logger.debug("read_msg: size: %d", size)
84 if len(buf) - 4 >= size:
85 text = struct.unpack("!%ds" % size, buf[4 : 4 + size])[0]
86 return (size, text, buf[4 + size :])
87 else:
88 return (size, "", buf)
89
90
91def read_fields(buf: bytes) -> tuple:

Callers

nothing calls this directly

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected