[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] How do I get the client IP address?
I am unfortunately not doing HTTP, so that approach will not work for me.
I am building my code on a bufferevent sample for a custom protocol,
and I guess I could try to get it based on the raw socket, but am
reluctant to do so since it would possibly make it more difficult to
port later on. The portability aspect is one of the reasons I started
with libevent in the first place.
Christian
On Fri, Dec 10, 2010 at 11:30 AM, Dirk-Willem van Gulik
<dirkx@xxxxxxxxxxxxxx> wrote:
>
> 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.
>
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.