You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Gregory Nicholls <gn...@level8.com> on 2000/07/25 18:05:15 UTC

ap_connect - part 2

  Jeff Trawick wrote:

> Ahh... Silly me... I was looking in the Unix code.  Sorry!  I'll put
> in the trivial change to the win32 version so that it works like the Unix code.
>

  While you're in there could you check something else for me plz ??  I was attempting a
bind to port 0 and then trying to use get_local_port to retrieve the port that is
(theoretically) assigned. Now this (again Win32 only) didn't work. It returned port 0. The
code for this function is:

    *port = ntohs(sock->local_addr->sin_port);
    return APR_SUCCESS;

in sockaddr.c.

    Now I don't know if I'm interpreting the function's purpose correctly however I think it
needs a getsockname() call somewhere along the line . . .

    G.


Re: ap_connect - part 2

Posted by Gregory Nicholls <gn...@level8.com>.
 OK I'll give it a whirl. For the record I'm CVS ignorant and barely Unix literate (old MF guy I'm
afraid). I'll take a stab at it and we can all have a good laugh at the results.
    G.
(who's now off to see if he can get CVS working ....)

Jeff Trawick wrote:

> Gregory Nicholls <gn...@level8.com> writes:
>
> >   While you're in there could you check something else for me plz ??  I was attempting a
> > bind to port 0 and then trying to use get_local_port to retrieve the port that is
> > (theoretically) assigned. Now this (again Win32 only) didn't work. It returned port 0. The
> > code for this function is:
> >
> >     *port = ntohs(sock->local_addr->sin_port);
> >     return APR_SUCCESS;
> >
> > in sockaddr.c.
> >
> >     Now I don't know if I'm interpreting the function's purpose correctly however I think it
> > needs a getsockname() call somewhere along the line . . .
> >
> >     G.
>
> Yes sir, that is correct.  A getsockname() call could be added after
> bind() (and connect() for that matter), or
> getsockname-deferral/avoidance logic (like in the
> lib/apr/network_io/unix code) could be implemented in the Win32 path.
> Either method is simple to implement.  Do you want to handle this and
> post the patch?  It looks like you're in a position to test it.  I
> don't have time in the short term.
>
> I'd recommend getting your anonymous cvs access working first so that
> you can use the output of "cvs diff -u filename ..." as the patch to
> post to the list when you get it working.
>
> --
> Jeff Trawick | trawick@ibm.net | PGP public key at web site:
>      http://www.geocities.com/SiliconValley/Park/9289/
>           Born in Roswell... married an alien...


Re: ap_connect - part 2

Posted by Jeff Trawick <tr...@bellsouth.net>.
Gregory Nicholls <gn...@level8.com> writes:

>   While you're in there could you check something else for me plz ??  I was attempting a
> bind to port 0 and then trying to use get_local_port to retrieve the port that is
> (theoretically) assigned. Now this (again Win32 only) didn't work. It returned port 0. The
> code for this function is:
> 
>     *port = ntohs(sock->local_addr->sin_port);
>     return APR_SUCCESS;
> 
> in sockaddr.c.
> 
>     Now I don't know if I'm interpreting the function's purpose correctly however I think it
> needs a getsockname() call somewhere along the line . . .
> 
>     G.

Yes sir, that is correct.  A getsockname() call could be added after
bind() (and connect() for that matter), or
getsockname-deferral/avoidance logic (like in the
lib/apr/network_io/unix code) could be implemented in the Win32 path.
Either method is simple to implement.  Do you want to handle this and 
post the patch?  It looks like you're in a position to test it.  I
don't have time in the short term.

I'd recommend getting your anonymous cvs access working first so that
you can use the output of "cvs diff -u filename ..." as the patch to
post to the list when you get it working.

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...