0

I need to convert pid to binary in Erlang, and send it to another pid. But i need the size of the binary data to be 1 byte. Is it posible?

dda
  • 6,030
  • 2
  • 25
  • 34
USer22999299
  • 5,284
  • 9
  • 46
  • 78

2 Answers2

6

You can't do this. One byte can only represent 256 different values, and there are more than 256 possible process IDs. The PID encodes both the node identification and the implementation-dependent process numer; Can someone explain the structure of a Pid in Erlang? has more details. You need to arrange for your protocol to allow for more than one byte to be sent or stored.

Community
  • 1
  • 1
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
1

Given than a PID structure in Erlang is way more than 8 bits I would say the answer is no.

Community
  • 1
  • 1