httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject bind-connect in rfc1413.c
Date Thu, 02 Sep 1999 15:08:50 GMT

Okay, I must be missing something.  I am trying to put some of the APR
stuff into Apache 2.0, and I came across a case I wasn't prepared for when
I wrote APR.

In rfc1413.c, line 130:

bind (sock, &our_query_sin, sizeof(struct sockaddr_in));

On line 141:

connect(sock, &rmt_query_sin, sizeof(struct sockaddr_in));

It's the same socket in both calls, and it's a SOCK_STREAM socket.  Why
are we binding and then connecting?  There are comments about trying to
bind both local and remote ends to the same IP addr.  But this doesn't
make any sense to me.  Dean seems to have a comment at the beginning of
the function saying something is broken, but he isn't specific about what
it is.

In all of the TCP/IP network programming I have done, bind is done on the
server side, and connect is done on the client side.  In fact, most of my
books say the bind is really unnecessary.

So, what am I missing?


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message