[lug] source for bind(int sockfd, struct sockaddr *my_addr, int addrlen)
Chris Riddoch
socket at peakpeak.com
Wed Apr 18 16:25:06 MDT 2001
"Matt McIllece (1-3762)" <mcillece at elbonia.ast.lmco.com> writes:
>
>
> >When you write a program in C that uses bind(), you'll need to put:
> >
> >#include "sys/types.h"
> >#include "sys/socket.h"
> >
> >at the top of your source code. If you look at these files, which are
> >/usr/include/sys/types.h and /usr/include/sys/socket.h, the interface
> >for the bind() function is provided in socket.h
>
> Yes, but on my machine,
>
> find /usr/src -name "socket.h" -print | xargs grep -ni bind
That's because it's not in /usr/src. It's in /usr/include/sys.
> I want the source code for bind() so I can see how it does what it does...
The reason this is a hard question to answer is because I wasn't being
specific enough, I think. I'm tempted to ask, which *kind* of bind()
are you asking for? ipv4? ipv6? The "actual" bind() call isn't
implemented once- it's implemented once for each family of networks
that linux suupports, because not all networks behave the same.
More information about the LUG
mailing list