There are a lot of books in the book, not much saying!
problem:
Compile success, connection failed.
solve:
Old and bald tips: man
Finally found this winter:
To Use this function, link in the realtime library by specifying -lrt on the compiler or linker command line.