tags:

views:

67

answers:

4

I compile my simple prog with #include <sys/socket.h> but there's none of this file. Where is it, I just start coding in linux and I have no idea where is it . Or do we need to download it online .

+10  A: 

In case you have installed manual pages, the first stop should be man socket.

Without manual pages you could call

find /usr/include -name socket.h

which outputs

/usr/include/asm/socket.h
/usr/include/sys/socket.h
/usr/include/bits/socket.h
/usr/include/linux/socket.h

on my system, the one to include is sys/socket.h .

Also see the Single UNIX Specification.

Peter G.
thanks there's another place, the find tool and include folder is useful :)
nXqd
+1 for teaching how to find it
Default
A: 

It should be #include <sys/socket.h>. You may also need to include sys/types.h.

But if that's failing, can you give a short snippet of source, including what files you're #include'ing and how, and what error message(s) you're getting?

Chris J
+2  A: 
man socket

should give you the answer.

mouviciel
+2  A: 

You need to

#include <sys/socket.h>

See this :

http://linux.die.net/man/7/socket

VJo