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

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



Op 10 dec 2010, om 11:51 heeft Christian Dahlqvist het volgende geschreven:

> 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. Can somepone please help
> point me in the right direction?

if you are doing HTTP - check

	evhttp_connection_get_peer (struct evhttp_connection *evcon, char **address, u_short *port)

otherwise - if you use libevent raw - then you'll have direct access to the socket info. Or just post the code snippet.

Dw.***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.