Don't include <sys/types.h>. Define socklen_t if not already happened.