[Mono-bugs] [Bug 471580] New: Socket ReuseAddress doesn't seem to work for UDP sockets on Mac OS X

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 2 12:01:48 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=471580


           Summary: Socket ReuseAddress doesn't seem to work for UDP
                    sockets on Mac OS X
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: Other
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: benoit at zeroc.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

Binding 2 different datagram sockets to the same IP/port fails on Mac OS X,
works on Linux & Windows.


Steps to reproduce the problem:
1. Run the test case below


Actual Results:
macbookpro:~/Devel$ mono ./test.exe
System.Net.Sockets.SocketException: Address already in use
  at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x00000] 
  at Client.Main (System.String[] args) [0x00000] 


Expected Results:
None

How often does this happen? 
Always

Additional Information:

Here's the test case:

    public static void Main(string[] args)
    {
        try
        {
            Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
            socket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress, 1);
            socket.Bind(new IPEndPoint(IPAddress.Any, 12345));

            Socket socket2 = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
            socket2.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress, 1);
            socket2.Bind(new IPEndPoint(IPAddress.Any, 12345));
        }
        catch(SocketException ex)
        {
            Console.WriteLine(ex);
        }
    }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list