[Mono-bugs] [Bug 498507] mono _sometimes_ doesn't throw ObjectDisposedException when calling socket.Close()
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Apr 29 11:43:00 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=498507
User gonzalo at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=498507#c7
--- Comment #7 from Gonzalo Paniagua Javier <gonzalo at novell.com> 2009-04-29 09:42:59 MDT ---
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("130.57.21.18"), 8888), ConnectCallback,
socket);
if (!async.AsyncWaitHandle.WaitOne(5000, false))
{
socket.Close();
}
}
catch (Exception se)
{
Console.WriteLine(se.Message);
}
Console.ReadLine ();
}
private static void ConnectCallback(IAsyncResult async)
{
Socket socket = (Socket)async.AsyncState;
try
{
socket.EndConnect(async);
}
catch (ObjectDisposedException)
{
Console.WriteLine("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.
More information about the mono-bugs
mailing list