There is a build error on freebsd: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in' Include proper header file to solve this. Ref: https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html