views:

68

answers:

0

It is simple to implement a TCP port mapper using bufferevent_* functions of libevent.

However, the documentation states that "This file descriptor is not allowed to be a pipe(2)" and I doubt if it can handle the case of when we can only read or only write to a file descriptor.

Will libevent work correctly if the socket is shutdown in one direction shutdown(socket, SHUT_WR);? I expect it to discard remaining data in the buffer and not write there anymore, but continue reading from socket and calling a read handler.