| 17 | |
| 18 | |
| 19 | def BcastCallMethod(method): |
| 20 | req = BcastRequest(method=method) |
| 21 | # ASTBCAST + length (body,4byte) + body + feeedeed |
| 22 | hdr = BcastHeader(magic=0x54534143, |
| 23 | version=__version__) |
| 24 | req.header.CopyFrom(hdr) |
| 25 | body = req.SerializeToString() |
| 26 | buffer = [] |
| 27 | r = struct.pack("QH", 0x5453414342545341, len(body)) |
| 28 | buffer.append(r) |
| 29 | r = struct.pack("{}s".format(len(body)), body) |
| 30 | buffer.append(r) |
| 31 | r = struct.pack("I", 0xeedeeefe) |
| 32 | buffer.append(r) |
| 33 | r = bytes().join(buffer) |
| 34 | return r |
| 35 | |
| 36 | |
| 37 | sock = socket(AF_INET, SOCK_DGRAM) |