[asio] ENOMEM in example/multicast/receiver.cpp

When I run a second instance of multicast/receiver on FreeBSD 6.2-PRERELEASE I get ENOMEM thrown from socket_.bind. I set a conditional breakpoint on return from error_wrapper and I see that errno is 48 (EADDRINUSE). (gdb) run 0.0.0.0 239.255.0.1 The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/alnsn/src/boost/branches/HEAD/bin/boost/libs/asio/exampl e/multicast/receiver/gcc/debug/threading-multi/receiver 0.0.0.0 239.255.0.1 warning: Unable to get location for thread creation breakpoint: generic error [New LWP 100051] [New Thread 0x8064000 (LWP 100051)] [Switching to Thread 0x8064000 (LWP 100051)] Breakpoint 5, boost::asio::detail::socket_ops::error_wrapper<int> ( return_value=-1, ec=@0xbfbfe140) at socket_ops.hpp:59 59 return return_value; (gdb) print errno $11 = 48 (gdb) bt #0 boost::asio::detail::socket_ops::error_wrapper<int> (return_value=-1, ec=@0xbfbfe140) at socket_ops.hpp:59 #1 0x0804df84 in boost::asio::detail::socket_ops::bind (s=5, addr=0xbfbfe1a0, addrlen=16, ec=@0xbfbfe140) at socket_ops.hpp:90 #2 0x0804df41 in boost::asio::detail::reactive_socket_service<boost::asio::ip:: udp, boost::asio::detail::select_reactor<false> >::bind (this=0x805b0e0, impl=@0xbfbfe2a4, endpoint=@0xbfbfe1a0, ec=@0xbfbfe140) at reactive_socket_service.hpp:240 #3 0x0804cd7e in boost::asio::datagram_socket_service<boost::asio::ip::udp>::bi nd (this=0x805b0c0, impl=@0xbfbfe2a4, endpoint=@0xbfbfe1a0, ec=@0xbfbfe140) at datagram_socket_service.hpp:145 #4 0x0804c2cd in boost::asio::basic_socket<boost::asio::ip::udp, boost::asio::d atagram_socket_service<boost::asio::ip::udp> >::bind (this=0xbfbfe2a0, endpoint=@0xbfbfe1a0) at basic_socket.hpp:332 #5 0x0804a5fc in receiver (this=0xbfbfe2a0, io_service=@0xbfbfe730, listen_address=@0xbfbfe260, multicast_address=@0xbfbfe280) at receiver.cpp:31 #6 0x08049e44 in main (argc=3, argv=0xbfbfe7a8) at receiver.cpp:84 Alexander Nasonov http://nasonov.blogspot.com By the time we`ve made it, we`ve had it. -- Malcolm Forbes -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote

Alexander Nasonov wrote:
When I run a second instance of multicast/receiver on FreeBSD 6.2-PRERELEASE I get ENOMEM thrown from socket_.bind.
I fixed this problem, see attached patch. Beman, can I commit it? -- Alexander Nasonov http://nasonov.blogspot.com I almost had a pyschic girlfriend, but she left me before we met. -- Steven Wright -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote

Alexander Nasonov wrote:
Alexander Nasonov wrote:
When I run a second instance of multicast/receiver on FreeBSD 6.2-PRERELEASE I get ENOMEM thrown from socket_.bind.
I fixed this problem, see attached patch. Beman, can I commit it?
I've committed it. I didn't have a POSIX system available to test on, but hopefully you already tested it:-) Thanks very much for doing the work on this, --Beman

Beman Dawes wrote:
I've committed it. I didn't have a POSIX system available to test on, but hopefully you already tested it:-) I tested it using asio multicast receiver but only on FreeBSD because it didn't work neither on OpenBSD nor on Openwall linux (but I run 2.6 kernel which is not supported by Openwall).
To make sure it works on all my *nix systems, I added one testcase to error_code_test.cpp. It worked. Though, on OpenBSD I had to use "link=static" argument to bjam. -- Alexander Nasonov http://nasonov.blogspot.com If destruction be our lot, we must ourselves be its author and finisher. As a nation of freemen, we must live through all time, or die by suicide. -- Abraham Lincoln -- This quote is generated by: /usr/pkg/bin/curl -L http://tinyurl.com/veusy \ | sed -e 's/^document\.write(.//' -e 's/.);$/ --/' \ -e 's/<[^>]*>//g' -e 's/^More quotes from //' \ | fmt | tee ~/.signature-quote
participants (2)
-
Alexander Nasonov
-
Beman Dawes