[lug] source for bind(int sockfd, struct sockaddr *my_addr, int addrlen)

Matt McIllece (1-3762) mcillece at elbonia.ast.lmco.com
Wed Apr 18 09:49:52 MDT 2001

>> Can someone tell me where the source is for the function that binds a name to 
>> socket?
>A socket is never 'bound' to a name.

I'm just using the description from the manpage.  Is it incorrect?

BIND(2)             Linux Programmer's Manual             BIND(2)

       bind - bind a name to a socket

>The application 'bind' whose code you downloaded is a name server

Got it...

>> I also looked under /usr/src/linux, but didn't find bind() implemented there 
>> either.
>Oh, that's just the kernel. The functions you need to look at are in
>the C library (or libc as it's commonly called ;-) 

Should the source code for bind() be included with KRUD?  I searched everywhere 
under /usr and couldn't find it.  Does anyone have a more specific path to where 
it should be?

>You would want to read up a bit on linux/unix networking. There are two
>ways of doing this: you can browse through the man pages (start with
>bind, socket, connect, accept etc. ) and read the gnu info pages on the
>c library or get some books (which i find easier). Some starting points 
>would be (very personal choice):
> - DNS and Bind from OReilly
>   Basic introduction and instructions for the Domain Name Sytem
> - Beginning Linux Programming (Wrox Press) 
>   Covers everything from the shell to sockets etc.
> - Stevens: Unix Network Programming. Expensive but one
>   of my favourite books. This starts with simple examples
>   but covers a lot -- and the code examples alone are worth the
>   money. 
> If your local library has it, have a look at TCP/IP illustrated
> by Stevens. This might be overkill for your actuall problem but
> a good understanding of the inner workings of (inter)networking
> helps a lot.

Thanks.  I'll keep this handy for when I get into that, but for now all I need 
is the source code for bind().

More information about the LUG mailing list