• Create Account

### #ActualWashu

Posted 12 August 2013 - 12:01 PM

I'll check how I should send the data properly.
I'm currently sending this (const char*)message. Where message starts as a void*.
When I cout this data it outputs the text so I don't think that's the problem?
And I'm running a 64-bit windows 7. But this is just my Visual Studio setup that's 32-bit or not?

errno outputs "No Error".
I use printf(strerror(errno)) to show to error on my screen.

handle is the same if both cases yes. I don't think this could be a problem?

As already noted, sizeof(message) does not do what you expect. What you are sending is the first four bytes of message, and nothing else. This line is WRONG:

	int sent_bytes = sendto(handle, (const char*)message, sizeof(message), 0, (sockaddr*)&address, sizeof(sockaddr_in));

You need to pass to your function the data pointer AND the length of the data. The length of the data cannot be trivially determined from the pointer, assuming binary data, as there is no logical terminator.

### #1Washu

Posted 12 August 2013 - 12:00 PM

I'll check how I should send the data properly.
I'm currently sending this (const char*)message. Where message starts as a void*.
When I cout this data it outputs the text so I don't think that's the problem?
And I'm running a 64-bit windows 7. But this is just my Visual Studio setup that's 32-bit or not?

errno outputs "No Error".
I use printf(strerror(errno)) to show to error on my screen.

handle is the same if both cases yes. I don't think this could be a problem?

As already noted, sizeof(message) does not do what you expect. What you are sending is the first four bytes of message, and nothing else. This line is WRONG:

	int sent_bytes = sendto(handle, (const char*)message, sizeof(message), 0, (sockaddr*)&address, sizeof(sockaddr_in));


PARTNERS