Libevent introduced the LEV_OPT_BIND_IPV6ONLY to pass to evconnlistener_new_bind to make it automatically set the underlying socket as accepting ipv6 requests. This works fine on posix compliant platforms as by the standard every new AF_INET6 socket is created as both supporting ipv6 and ipv4 connections. But on windows the default is the opposite, with the flag IPV6_V6ONLY being always enabled by default. This makes creating a listener to supports both protocols a bit more tricky as winsock doesn't allow changing this flag after evconnlistener_new_bind does all the initial setup because as stated in the docs, you can't change it after the sonnect connected, so one would have to manually create the socket beforehand and set the flag and then call evconnlistener_new with the socket itself. It would be nice to have libevent keep a consistent behaviour across the platforms in this scenario, maybe or by making it always set IPV6_V6ONLY to false unless LEV_OPT_BIND_IPV6ONLY is passed, in which case it's set to true, or add another flag to forcefully set it to false and keep the system dependent behaviour as default. So this patch add new option for libevent listeners to bind to both - LEV_OPT_BIND_IPV4_AND_IPV6
1. BUILDING AND INSTALLATION
Autoconf
$ ./configure
$ make
$ make verify # (optional)
$ sudo make install
See Documentation/Building#Autoconf for more information
CMake (Windows)
Install CMake: https://www.cmake.org
$ md build && cd build
$ cmake -G "Visual Studio 10" .. # Or use any generator you want to use. Run cmake --help for a list
$ cmake --build . --config Release # Or "start libevent.sln" and build with menu in Visual Studio.
See Documentation/Building#Building on Windows for more information
CMake (Unix)
$ mkdir build && cd build
$ cmake .. # Default to Unix Makefiles.
$ make
$ make verify # (optional)
See Documentation/Building#Building on Unix (With CMake) for more information
Package Managers
You can download and install libevent using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install libevent
The libevent port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
2. USEFUL LINKS:
For the latest released version of Libevent, see the official website at http://libevent.org/ .
There's a pretty good work-in-progress manual up at http://www.wangafu.net/~nickm/libevent-book/ .
For the latest development versions of Libevent, access our Git repository via
$ git clone https://github.com/libevent/libevent.git
You can browse the git repository online at:
https://github.com/libevent/libevent
To report bugs, issues, or ask for new features:
Patches: https://github.com/libevent/libevent/pulls
OK, those are not really patches. You fork, modify, and hit the "Create Pull Request" button. You can still submit normal git patches via the mailing list.
Bugs, Features [RFC], and Issues: https://github.com/libevent/libevent/issues
Or you can do it via the mailing list.
There's also a libevent-users mailing list for talking about Libevent use and development:
http://archives.seul.org/libevent/users/
3. ACKNOWLEDGMENTS
The following people have helped with suggestions, ideas, code or fixing bugs.