Hello,
I'm playing with the libevent2 rot13 server example and I was wondering
how you can make the server respond to "quit" and then close the socket.
I have looked through various documents but I haven't been able to find
a way to get the 'fd' for the socket through the "bufferevent" so I
can't just close() it.
Am I supposed to pass the fd around myself? Or am I simply missing
something here? Any pointers would be welcome.
Below is a sample, trimmed down, piece code to illustrate my problem:
void readcb(struct bufferevent *bev, void *ctx)
{
struct evbuffer *input, *output;
// ...
input = bufferevent_get_input(bev);
output = bufferevent_get_output(bev);
while ((line = evbuffer_readln(input, &n, EVBUFFER_EOL_LF))) {
// ...
if (!strcmp(line, "quit"))
{
evbuffer_add(output, "Bye!");
// what do I put here?
}
free(line);
}
}
Thanks,
Bas Verhoeven
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users