S
Stewart Stevens
I have a structure that looks like this:
[StructLayout(LayoutKind::Sequential)]
public __value struct mytype
{
float first;
float second;
};
I am trying to pass arrays of these things over a socket. So I have:
mytype items __gc []
and need to provide
Bytes rawbytes __gc []
to the socket code.
Right now I am using BitConvertor to do this conversion. It works for the
moment but I don't consider this acceptable. Partly because of the obvious
inefficiency but mostly because I want to use the same socket code to deal
with simple arrays of managed floats. I've tried many ways of casting the
array and it's just not happening.
Type saftey isn't a big concern for me at this level because the code is
private to my assembly. (The same assembly contains implementations for
both sides of the socket.) I wanted to use dotnet rather than win32
sockets because my client is written entirely in managed code.
Can anyone help me with a trick for those arrays?
[StructLayout(LayoutKind::Sequential)]
public __value struct mytype
{
float first;
float second;
};
I am trying to pass arrays of these things over a socket. So I have:
mytype items __gc []
and need to provide
Bytes rawbytes __gc []
to the socket code.
Right now I am using BitConvertor to do this conversion. It works for the
moment but I don't consider this acceptable. Partly because of the obvious
inefficiency but mostly because I want to use the same socket code to deal
with simple arrays of managed floats. I've tried many ways of casting the
array and it's just not happening.
Type saftey isn't a big concern for me at this level because the code is
private to my assembly. (The same assembly contains implementations for
both sides of the socket.) I wanted to use dotnet rather than win32
sockets because my client is written entirely in managed code.
Can anyone help me with a trick for those arrays?