Try
byte[] received;
aMsg m;
fixed (byte* pBuffer = received)
{
m = *((aMsg*) pBuffer);
}
-----Original Message-----
From: Miguel �ngel Chac�n [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 5:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] byte[] to Object
Thanks, but maybe I don't explain it very well. I need to read the values written by
another app, that is Unmanaged(C++,VB), in a socket. I can't alter the way the data is
written, because is another app, but I know the structure of the data, just like:
(C++) (C#)
struct aMsg struct aMsg
{ {
DWORD a; int a;
DWORD b; int b;
DWORD c; int c;
} }
Then, the C++ structure is written in the socket, and then I receive the byte[] in C#.
I want to do something like (so simple):
byte[] received;
aMsg myMsg=(aMsg)received;
Is this possible?
-----Mensaje original-----
De: dotnet discussion [mailto:[EMAIL PROTECTED]] En nombre de Graeme Humphrey
Enviado el: mi�rcoles, 29 de mayo de 2002 13:18
Para: [EMAIL PROTECTED]
Asunto: Re: [DOTNET] byte[] to Object
You might want to examine the section on Serialisation in MSDN.
ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconbinaryserialization.htm
Hope this helps,
Graeme
> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf
Of
> Miguel �ngel Chac�n
> Sent: 29 May 2002 10:48
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] byte[] to Object
>
>
> I need to convert a byte[] received from a low-level socket connection
> to an object, and then cast to a user-type object. Is this possible?
How
> can I do?
>
> Thanks a lot.
>
> You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
>
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe
to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe
to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.