LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   differ between linux and solaris in socket programming (https://www.linuxquestions.org/questions/programming-9/differ-between-linux-and-solaris-in-socket-programming-340466/)

taureanyang 07-06-2005 01:27 AM

differ between linux and solaris in socket programming
 
I have written a echo server and client on linux, and they run well.
But when I copy these files on solaris , and compiled them,
there come some errors. It said that " socket, accept , bind ,listen not defined" .
I have used "#include <sys/socket.h>" to import these functions.
Does these functions not be defined in sys/socket.h ?
Thanks

jlliagre 07-06-2005 02:02 AM

You need to link with the network libraries, add these options to your command:
Code:

... -lnsl -lsocket

taureanyang 07-06-2005 03:27 AM

Thank you jlliagre .


All times are GMT -5. The time now is 05:55 PM.