首页 文章

通过TCP接收结构c#[重复]

提问于
浏览
0

这个问题在这里已有答案:

这篇文章与我之前的帖子直接相关

Sending C structs through TCP in C#

我的下一个问题是从设备接收适当的响应 . 该文档为我提供了返回结构的以下代码 .

typedef struct{
/*This value represents if the API request to modify has been a success or not*/
return_t ret_val;

/*Error code indicating error details*/
error_t err_code;

/*Response object for GET type action*/
U8 payload[0];
}MsgResp;

我的问题是,如何通过TCP接收到的原始字节流到这个结构中?再一次,我的直觉告诉我与memcpy有关,但我不知道这是如何转换为C# .

我也对类型return_t和error_t感到困惑,所以对这些类型的任何见解也会有所帮助 .

1 回答

相关问题