Home Forums Support How to send and receive object type Reply To: How to send and receive object type

#2971
Anonymous
Inactive

An object is sent over a network as an array of bytes, e.g:

115
100
103
100
52

It is impossible to know what these bytes mean unless the correct type is known. For example:

int integer = BitConverter.ToInt32(result, 0);
//integer = 1684497523

string str = Encoding.ASCII.GetString(result);
//str = sdgd4

float dbl = BitConverter.ToSingle(result, 0);
//dbl = 1.7073744E+22

Which is the correct answer?

Marc