[Mono-bugs] [Bug 464145] Cannot create more than ~1000 sockets

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 12 12:15:06 EST 2009


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

User amcgovern at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=464145#c7





--- Comment #7 from Alan McGovern <amcgovern at novell.com>  2009-01-12 10:15:06 MST ---
Yeah, the ~1000 socket limit is a system issue and completely unrelated to
mono. It's the assert that is more interesting.

I still get the assert failure, just to make sure you're running the right
testcase, execute the attached testcase and just wait a few seconds once you
hit the Console.ReadLine (). Don't press a key.



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

namespace Test
{
    class MainClass
    {
        static List<Socket> list = new List<Socket>();
        public static void Main(string[] args)
        {
            TcpListener listener = new TcpListener(10000);
            listener.Start(1);
            for (int i = 0; i < 100000; i++)
            {
                try
                {
                    Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
                    IAsyncResult result = s.BeginConnect(IPAddress.Loopback,
10000, null, null);
                    list.Add(listener.AcceptSocket());
                    s.EndConnect(result);
                    list.Add(s);
                }
                catch (SocketException ex)
                {
                    if (ex.ErrorCode == 10024)
                    {
                        Console.WriteLine("Instantiate {0} sockets",
list.Count);
                        Console.WriteLine(ex);
            Console.ReadLine ();
                        return;
                    }
                }
            }

            Console.WriteLine("Success");
        }
    }
}

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