Hi, i would like to build simple HTTPD server using libevent2. It is going to send some quite big files but i would like it to handle couple concurrent connections. The files can be sent in chunks so I'm using evhttp_send_reply_chunk for this. The problem is, how can I send big files while still being able to handle new connections?
I have found something like this in test suit: static void http_chunked_cb(struct evhttp_request *req, void *arg) { [...] evhttp_send_reply_start(req, HTTP_OK, "Everything is fine"); event_once(-1, EV_TIMEOUT, http_chunked_trickle_cb, state, &when); } static void http_chunked_trickle_cb(evutil_socket_t fd, short events, void *arg) { [...] evhttp_send_reply_chunk(state->req, evb); [...] event_once(-1, EV_TIMEOUT, http_chunked_trickle_cb, state, &when); [...] } So it basically uses event_once with EV_TIMEOUT to send next chunk. EV_TIMEOUT is not the best for my purpose and there is also a problem when client disconnect in the middle of the transfer, however. I can't get fd of the connection form evhttp_request so it's impossible to set event callback for EV_WRITE instead of EV_TIMEOUT. So my question is, how this should be done properly? Thank you in advance for any suggestion. *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.