C
chrisben
Hi, I would to send data as the most efficient way, as compact and as fast as
possible. So I think any serialization is out of picture.
A fundamental way is to translate all my fields in the class as bytes and
pass it, then reconstruct it on other side. This may also save me a lot of
hassle if passing between windows and linux, c# and c++.
So i try to use Buffer.BlockCopy to create byte array, pass it to socket.
use BitConverter to read them back. I like to use fixed size array for
efficient parsing at the client side. The only problem I run into is string
assuming I have one field called
string ID; I know ID has variable lengh but less than 6. So I like to pass
take 6 bytes of the array buffer and other side will take it and convert it
back. The problem is that I cannot find a proper method in C# to do it. Seems
I have to define the exact length to pass the array in C#. is that possible
to pass a variable length string to a fixed size byte array and convert it
back as string?
thanks
possible. So I think any serialization is out of picture.
A fundamental way is to translate all my fields in the class as bytes and
pass it, then reconstruct it on other side. This may also save me a lot of
hassle if passing between windows and linux, c# and c++.
So i try to use Buffer.BlockCopy to create byte array, pass it to socket.
use BitConverter to read them back. I like to use fixed size array for
efficient parsing at the client side. The only problem I run into is string
assuming I have one field called
string ID; I know ID has variable lengh but less than 6. So I like to pass
take 6 bytes of the array buffer and other side will take it and convert it
back. The problem is that I cannot find a proper method in C# to do it. Seems
I have to define the exact length to pass the array in C#. is that possible
to pass a variable length string to a fixed size byte array and convert it
back as string?
thanks