I'm facing the following problem :
I need to send a byte to a server.
This byte should contain the following :
- high order nibble with
1011
- low order nibble containing a number representation between 1 and 15, so here let's take 2 for the e.g.
So the full byte should be 10110010
.
There is a corresponding thread for reading the byte in two distinct nibbles, but not for building it.
The goal I have to achieve is to first, build the byte depending on the size value, here 2, and then send it to a socket so that the server receive the byte 10110010
(hence b2
in hex)
I have read lot of examples but couldn't find one that narrow my situation.
So how can I build this byte and convert it in a format for a socket binary stream.
Thanks,