Bug 26891 - Bug in Socket.ConnectAsync Disposal
Summary: Bug in Socket.ConnectAsync Disposal
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-09 21:04 UTC by Craig
Modified: 2016-04-16 09:10 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Craig 2015-02-09 21:04:02 UTC
The following code will cause an unhandled exception after about 30 seconds.  It seems that the connection attempt continues even after the socket is closed.  I've compared this vs. standard Microsoft .NET implementation and the standard implementation doesn't throw an error.


using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{

           //Simulate Socket Async Connection
           var e = new SocketAsyncEventArgs();
           e.RemoteEndPoint = new DnsEndPoint(host, port);
           socket.ConnectAsync(e);

           //Simulate aborting connection before fully connected
           //Useful if you want to implement a timeout
           socket.Close();
}

Note You need to log in before you can comment on or make changes to this bug.