Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

9
[UDP protocol] data misinterpretation
Post Flair (click to view more posts with a particular flair)
Author Summary
ad97lb is in UDP protocol
Post Body

[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.

Author
User Suspended
Account Strength
0%
Suspended 6 months ago
Account Age
4 years
Verified Email
Yes
Verified Flair
No
Total Karma
272
Link Karma
1,137
Comment Karma
1,024
Profile updated: 3 days ago
Posts updated: 6 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 months ago