I am using a python script as a TCP client. At one point it receives what should be a bool back from the server. When I was first writing this and testing it on a machine that was using a regular python install I was able to use the following code from the struct module to unpack the data received back as a bool
data = socket.recv(BUFFER_SIZE)
result = struct.unpack("?", data)[0]
if not result:
#do stuff here
I currently need to perform the same task in an environment that only uses ironpython. When I attempt to run the code I get the following:
ImportError: No module named struct
After a bit of digging it seems that the struct module in regular python doesn't exist in ironpython (I believe a struct module exists, but it is for interfacing with c/c++ structs)
How can I take the data from a TCP socket.recv and convert it from the bytes format actually received to the bool type I need it to be in ironpython?