0

This post is directly related to an earlier post I made

Sending C structs through TCP in C#

My next problem is receiving the appropriate response from the equipment. The documentation gives me the following code for the returned struct.

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;

My question is, how do I get the raw byte stream received over TCP into this struct? Again, my instinct tell me something to do with memcpy, but I don't know how this translates to C#.

I am also confused about the types return_t and error_t, so any insight into those would also be helpful.

Community
  • 1
  • 1
DaveB
  • 2,199
  • 2
  • 14
  • 11

1 Answers1

0

The link from SLaks comment above is exactly what I needed.

Link here: How To Convert Structure to byte array in C#

Community
  • 1
  • 1
DaveB
  • 2,199
  • 2
  • 14
  • 11