You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Dror Shilo <Dr...@ericom.com> on 2004/12/22 19:54:23 UTC
find the bind port in apr version 1.0.1
In apr version 1.0.1 the function
apr_sockaddr_port_get was removed.
So if you bind to port 0 , and after the bind you have to find the port that was peeked . how you can do it ?
> Best regards,
>
> ******************************************
> Dror Shilo
> Ericom Software Ltd.
>
> dror.shilo@ericom.com
> Tel: +(972) 2 591 1700 ext. 737
> Fax: +(972) 2 571 4737
>
> Extend the Way you Access
Re: find the bind port in apr version 1.0.1
Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, 22 Dec 2004 20:54:23 +0200, Dror Shilo <Dr...@ericom.com> wrote:
>
>
> In apr version 1.0.1 the function
>
> apr_sockaddr_port_get was removed.
>
> So if you bind to port 0 , and after the bind you have to find the port that
> was peeked . how you can do it ?
You need to call apr_socket_addr_get(&x, APR_LOCAL, s) to fill out a
sockaddr with local address information, after which you can reference
the port field in the returned sockaddr.
The old apr_sockaddr_port_get() function didn't eliminate the need to
call apr_socket_addr_get().
Re: find the bind port in apr version 1.0.1
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
Dror Shilo wrote:
> In apr version 1.0.1 the function
>
> apr_sockaddr_port_get was removed.
>
> So if you bind to port 0 , and after the bind you have to find the port
> that was peeked . how you can do it ?
Well, all apr_sockaddr_port_get did was return the 'port' field in the
sockaddr. If all you want is the same behavior apr_sockaddr_port_get
used to have you can just grab that value, although honestly I'm not
sure that it will have the correct value after a bind to port 0, so what
you're asking for may never have worked.
-garrett