I am trying to write a function in python 3.x that returns a single byte of data to send over a TCP connection.
The data I am trying to send is an unsigned integer from 0-100.
I am checking the bytes used by the data with sys.getsizeof(data), but I have not come across an instance where sys.getsizeof(data) == 1 .
lets say data = 10
I have tried several different ways to store a byte:
1) struct.pack('>b', 10)
2) bytes(10), bytes([10])
3) 0x10
4) bytearray(10)
5) b'10'
all of these have returned over double digits in byte size.
I am looking for a way in python to send a single byte over a TCP socket.