http://bugzilla.novell.com/show_bug.cgi?id=498507


           Summary: mono _sometimes_ doesn't throw ObjectDisposedException
                    when calling socket.Close()
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: 32bit
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.59 Safari/525.19

Consider the following code, which should display "closed" every time. Under
mono in OS X, sometime, it doesn't - socket.close doesn't induce an
ObjectDisposedException : 

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

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

            try
            {
                IAsyncResult async = socket.BeginConnect(new
IPEndPoint(IPAddress.Parse("INEXISTANT_IP_HERE"), 8888), ConnectCallback,
socket);

                if (!async.AsyncWaitHandle.WaitOne(3, false))
                {
                    socket.Close();
                }
            }
            catch (Exception se)
            {
                Console.WriteLine(se.Message);
            }
        }

        private void ConnectCallback(IAsyncResult async)
        {
            Socket socket = (Socket)async.AsyncState;

            try
            {
                socket.EndConnect(async);
            }
            catch (ObjectDisposedException)
            {
                Console.WriteLine("closed");
            }
        }
    }
}



Reproducible: Sometimes

Steps to Reproduce:
1. see above code
2.
3.
Actual Results:  
Sometimes prints "closed", sometimes it doesn't

Expected Results:  
Always print "closed".

-- 
Configure bugmail: http://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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to