[Mono-bugs] [Bug 640749] New: Socket.LocalEndPoint returns null after non-blocking connect

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Sep 21 05:17:03 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=640749#c0


           Summary: Socket.LocalEndPoint returns null after non-blocking
                    connect
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jeroen at sumatra.nl
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;
Trident/5.0)

Repro:

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

class Program
{
    static void Main(string[] args)
    {
        using (Socket server = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp))
        {
            server.Bind(new IPEndPoint(IPAddress.Loopback, 0));
            server.Listen(1);
            using (Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp))
            {
                socket.Blocking = false;
                try
                {
                    socket.Connect(new IPEndPoint(IPAddress.Loopback,
((IPEndPoint)server.LocalEndPoint).Port));
                }
                catch (SocketException x)
                {
                    if (x.ErrorCode != 10035)
                        throw;
                }
                List<Socket> list = new List<Socket> { socket };
                Socket.Select(null, list, null, 10000);
                Console.WriteLine(list.Count);
                Console.WriteLine(socket.LocalEndPoint);
            }
        }
    }
}


Reproducible: Always

Steps to Reproduce:
Compile & Run (on Windows?)

Actual Results:  
1


Expected Results:  
1
127.0.0.1:64620

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