C# 在c中读取通过udp发送的结构 我有一个C++程序,通过UDP发送一个值结构: struct myData { double n1; double n2; }; myData* sendBuffer = (myData*)malloc(sizeof(mydata)); memcpy(sendBuffer, &mydata, sizeof(mydata));

C# 在c中读取通过udp发送的结构 我有一个C++程序,通过UDP发送一个值结构: struct myData { double n1; double n2; }; myData* sendBuffer = (myData*)malloc(sizeof(mydata)); memcpy(sendBuffer, &mydata, sizeof(mydata));,c#,c++,udp,C#,C++,Udp,然而,在c、winforms中的服务器端,我使用了如下内容: IPAddress address = IPAddress.Parse("127.0.0.1"); IPEndPoint ipep = new IPEndPoint(address, 8888); UdpClient newsock = new UdpClient(ipep); while (true) { var received = newsock.Receive(ref ipep); } 我知道,在C++中,我可以

然而,在c、winforms中的服务器端,我使用了如下内容:

IPAddress address = IPAddress.Parse("127.0.0.1"); 
IPEndPoint ipep = new IPEndPoint(address, 8888);
UdpClient newsock = new UdpClient(ipep);

while (true)
{
    var received = newsock.Receive(ref ipep);
}

<>我知道,在C++中,我可以简单地调用服务器端的MEMPCY来自动获取值的结构,但是在C?< /P >中有一种方法可以使用BitConverter.ToDouble。