Merge pull request #3086 from esdrubal/master
authormonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 1 Jun 2016 16:25:11 +0000 (17:25 +0100)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 1 Jun 2016 16:25:11 +0000 (17:25 +0100)
[System] Fixes socket async exception.

SendAsyncFile uses StartSocketServer to start a server and at the same
time begins to accept a client socket. The issue is that when
the accept callback is called SendAsyncFile already closed the socket.

Fixed race condition by moving StartSocketServer and ReceiveCallback
logic into SendAsyncFile, and by using a new MRE to ensure that the
client receives all the data before the server is closed.

Fixes [#41264](https://bugzilla.xamarin.com/show_bug.cgi?id=41264)


Trivial merge