Re: Sending a struct to embeded CPU over the Ethernet




"Eitan" <Eitan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:27853735-BAB6-47B2-90AD-2E7D557DC74B@xxxxxxxxxxxxxxxx
Hello,

I need to send a "struct" to an embeded CPU over the Ethernet.

The struct is defined like this:

[Serializable]
public struct MyStruct
{
public double dVar1;
public bool bVar2;
public int nVar3;
}

What would we the best way to pack it into an "array" and send it? Would
that be through Marshal.Copy!? or any other more effiecient way?

BitConverter and a byte[] the most straightforward.


Thanks
EitanB


.



Relevant Pages

  • Re: struct ToString() not automatically invoked
    ... I made a struct, and I want to ... public struct MyStruct ... public override string ToString() ... complain, and also wouldn't be invoked automatically. ...
    (microsoft.public.dotnet.languages.csharp)
  • MarshalAs attributes
    ... I am wondering if every single field of a struct needs to be completely ... public struct MYSTRUCT ... public int iFieldOne; ... public bool bFieldFour; ...
    (microsoft.public.dotnet.framework.interop)
  • Accessing and using managed Struct from COM
    ... VB6 application. ... If the Struct contains only int types, ... However, as soon as I add a string type to the C# struct, VB6 can no ... public struct MyStruct ...
    (microsoft.public.dotnet.framework.interop)