Hi !
The sender and the receiver must use the same protocol and handshaking
methods. For this purpose, I suggest that you find some Ethernet component
that works in both unmanaged programs and managed programs. This allows you
to build a consistent interface between the two worlds. After the component
has received the data, it can format it anyway you please to fit into the
managed structure.
From MC++, this is an easy step. In those code lines where you use the
component, wrap them into "#pragma unmanaged" sections. This creates an
unmanaged stub to ensure perfect compatibility with unmanaged components
inside a managed application. The C# process requires a COM proxy (P/Invoke)
unless the Ethernet component supports .NET.
-Antti Keskinen
"Jason Zhang" <jz****@sunrisetelecom.com.cn> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
Hi all,
If I have a program wroten in C,and defined a struct like this:
typedef struct data
{
int m_i;
int m_j;
}data;
data myData;
I send Mydata to another program via Ethernet.Just like below:
SocketObj.Send(&myData,sizeof(myData));//assume SocketObj is a Object that
can send msg via Ethernet
and the receiver is wroten in C# or VC++ 7.0 . I define a struct in it
too:
__gc class data : public Object
{
int m_i;
int m_j;
}
But ,how can I fill this class from the stream I got from Ethernet?
I tried BinaryFormatter,but I found that BinaryFormatter's format is not
pure ,
It contains may additive information.So ,BinaryFormatter does not work.
Is there any other way to solve this problem?I do not want to use
XML,although XML does work.