[FFmpeg-devel] [PATCH/RFC] Prefer getaddrinfo over gethostbyname

Martin Storsjö martin
Tue Jan 12 18:34:46 CET 2010

On Tue, 12 Jan 2010, Ronald S. Bultje wrote:

> Mac uses ss_len, which confused me for a second. len + family should
> be 16 bits, and len may be zero (unset), as is the case for FFmpeg on
> Mac. That still works fine. So the above should (and does) work.

No, that'd only work on big-endian, right? And if the ss_len/sa_len field 
for some reason happens to be set, things would fail in ways that are 
quite hard to debug/notice.

> I agree that it'd be nicer to include the ss_len conditionally
> depending on whether it is present in sockaddr_in, but as Mans said,
> ;-).

Hah. :-)

Regardless, I don't really have too much an opinion on this matter 
(initially, I just wanted thread-safe host resolving, and here we are 
now...). My vote is on casting to sockaddr and using sa_family instead 
since that has much less risk of getting screwed up on other platforms, 
but choose any one you like.

// Martin

More information about the ffmpeg-devel mailing list