[Mono-bugs] [Bug 476138] New: Win32 Socket behaviour changed.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 16 07:42:48 EST 2009


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


           Summary: Win32 Socket behaviour changed.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: i686
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: lucas.meijer at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6


While upgrading our mono to get all the latest bugfixes, I'm running into the
following, which looks like a win32 socket regression.

here is the program, see the other fields for expected results/actual results.
make sure to actually have something listening on port 1234.



using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net;

class Program
{
    static void Main(string[] args)
    {
        var s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);

        var ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 5655);
        s.Blocking = false;
        s.Bind(ep);
        s.Listen(5);

        var s2 = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
        s2.Bind(new IPEndPoint(IPAddress.Any, 0));
        s2.Blocking = false;

        try
        {
            //You actally need to be running something on port 1234. 
            s2.Connect(IPAddress.Parse("127.0.0.1"), 1234); 
        }
        catch (SocketException se)
        {
            // ignore blocking connect exception. shouldn't there be some other
way to do this...
            if (se.ErrorCode != 10035)
                throw se;
        }

        var errorList = new List<Socket>();
        var readList = new List<Socket>();
        var writeList = new List<Socket>();

        readList.Add(s);
        readList.Add(s2);
        errorList.Add(s);
        errorList.Add(s2);
        Socket.Select(readList, null, errorList, 100);

        if (errorList.Contains(s))
            Console.WriteLine("error on socket s");
        if (errorList.Contains(s2))
            Console.WriteLine("error on socket s2");
        if (readList.Contains(s))
            Console.WriteLine("available data on socket s");
        if (readList.Contains(s2))
            Console.WriteLine("available data on socket s2");
    }
}

Reproducible: Always

Steps to Reproduce:
1) compile the program
2) run it on mono-trunk (we used r126917)
3) run it on an older mono (we don't know the exact revision of our older
runtime, but it's about svn from november 28, 2008. Try 2.0)

4) compare reults.
Actual Results:  
On Mono-2ish, output is:

available data on socket s2

On Mono-SVN-Trunk-r126917, output is:


error on socket s
error on socket s2
available data on socket s
available data on socket s2



Expected Results:  
Identical results. The results from the 2.0 execution look like they are what
should be happening.

-- 
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