[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] How do I get the client IP address?



On Fri, Dec 10, 2010 at 4:21 PM, Christian Dahlqvist
<acdahlqvist@xxxxxxxxx> wrote:
> Hi,
>
> I am new to libevent, and am currently writing my first server using
> libevent 2.0.x. I have been trying to find an example of how to get
> the clients IP address when a new client connects, but have so far not
> found any support for it in the libevent API.

I am not so much experienced with libevent but a general pattern is to
accept() a new connection inside the callback registered on the
listening socket descriptor. In that case you get all the client info
you need inside a sockaddr_in structure. IMO you should be looking at
the socket API rather than the libevent one for this functionality.
Perhaps it'd help if you are more specific with what you are trying to
develop.
-- 
Anomit Ghosh
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.