This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
[SOLVED] I solved this problem by using manual packing
I hope I am in the right subreddit.
I am trying to send a buffer of data from a server written in C to a client written in C using UDP protocol/socket. The goal is to send sensor readings (real robot) to a control framework (client) and so the buffer contains information that represent the current state of the robot.
I was getting errors and so I started to print what the client is receiving to make sure everything is okay. The size of the buffer the client is receiving is correct but when we deserializes what the client receives, there is a data misinterpretation.
To give an example:
The server is sending an unsigned long long num_robots_ = 1 through the buffer, that would be represented by 8 bytes. The client receives the buffer and deserializes it and copy the data into an uint64_t num_robots_ on the client side (8 bytes too) but when I print the num_robots_ on the client side, I get (and I kid you not): 2587200682272452168
What could be causing this? Anybody have any experience with an error like this?
EDIT: I used Wireshark as some good folks of you suggested and I am indeed receiving a wrong buffer - the problem is in the C-server. I don't know why but the serialization is not correct. I honestly cannot wrap my head around what's going on.
Subreddit
Post Details
- Posted
- 9 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/networking/...