apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: How to get remote (client) address,...
Date Fri, 25 Oct 2002 12:06:30 GMT
Damir Dezeljin <programing@nib.si> writes:

> Hi.
> I writen an daemon which is executed in inetd (part of the code is below).
> I have problems getting remote IP address and remote port. I use:
>   apr_socket_addr_get(&addr_local, APR_LOCAL, apr_sock);
> to get local address and port, and
>   apr_socket_addr_get(&addr_local, APR_LOCAL, apr_sock);
> to get the remote one, but this doesn't work (I get for the IP and
> port 0).
> Any sugestion in welcome.

looks like there's a bug getting in your way :)

the APR code assumes that we always know the remote address because it
is filled in by apr_os_sock_make() or apr_connect() or apr_accept()

but your situation was different... the socket was already connected
and you called apr_os_sock_put()

note that you could have called apr_os_sock_make() and specified the
remote sockaddr, but you want APR to do all the work and it is falling
down on the job

I'll see what I can do.

Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

View raw message