[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Ability to shutdown() socket with bufferevents?
On Tue, Jul 27, 2010 at 12:55 PM, Corey Stup <coreystup@xxxxxxxxx> wrote:
> I'm needing the ability to shutdown(fd, 1) on a bufferevent managed
> socket [created with bufferevent_socket_new() and
> bufferevent_socket_connect()] as part of my protocol. The flow of
> which looks somethign like this:
>
> Client opens connection to server
> Client sends data.
> Client closes the sending side of the socket to indicate EOF.
> Server sees EOF and closes the receive side of the socket
> Client
>
> For my first pass at this client, I'm using a bufferevent, but without
> an obvious way to send a EOF, it seems like I'm stuck. It appears
> that at some point in the future, bufferevent_flush(..., EV_WRITE,
> BEV_FINISHED) may provide what I'm looking for, but its not yet
> implemented.
>
> Anyone have any suggestions?
Right now there's no way to make a bufferevent call shutdown() itself,
but what if you have a write handler on the client bufferevent just
call shutdown() manually on the fd to send a FIN when the write buffer
is empty? You can get the fd with bufferevent_get_fd().
yrs,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.