Skip to content

Instantly share code, notes, and snippets.

@sodabrew
Created May 10, 2012 19:10
Show Gist options
  • Save sodabrew/2655193 to your computer and use it in GitHub Desktop.
Save sodabrew/2655193 to your computer and use it in GitHub Desktop.
libevent HTTP server client IP address
void http_request_cb(struct evhttp_request *req, void *user)
{
char *client_ip;
u_short client_port;
evhttp_connection_get_peer(evhttp_request_get_connection(req), &client_ip, &client_port);
printf("Client IP [%s] port [%d]\n", client_ip, client_port);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment