Added checks to avoid including netdb.h on platforms that don't provide it.