j0r1 / JRTPLIB

RTP Library
MIT License
584 stars 219 forks source link

sendto system call return value ignored #34

Open theicfire opened 5 years ago

theicfire commented 5 years ago

In RTPUDPv4Transmitter::SendRTPData, I notice that the return value of sendto is simply ignored. There's a variety of issues that may show up with the call. At the very least, it would be good to check that sendto was successful, by checking that the return value is the same as the length of bytes written. If it's not successful, some sort of error should show up, even it's as simple as "sendto failed".

j0r1 commented 5 years ago

While error reporting is certainly a good idea, I'm not sure how best to handle this in practice. These calls are in a loop, as several destinations are traversed.

I'm curious, did you encounter a problem with sendto in practice?

theicfire commented 5 years ago

I didn't see them show up in practice, no. I think I was looking through the code when tracking down another issue (receive buffer sizes, which you allow to change, thanks!)

Frankly even a TODO comment on the sendto commands mentioning that the errors are being ignored would be a step in the right direction. If someone's tracking down a sendto issue, they could just print out errors themselves, like I ended up doing.