What is the best way to send an enum value through sockets? Is there a way to convert an enum value to an int and vice versa?
Like:
Enum values {
value1,
value2
}
int value = (int)value1;
And...
values value2 = (value) value;
Would be very nice to send this over the internet!
Thanks all!
Bas
Either marshall to
int:or to
String:The former saves some spaces (32-bits as opposed to varying-length strings) but is harder to maintain, e.g. rearranging
enumvalues will breakordinal()backward compatibility. On the other handordinal()allows you to renameenumvalues…