You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
@ -16,8 +16,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
ManualResetEvent mainEvent;
|
||||
Exception error;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void SetUp ()
|
||||
void SetUp ()
|
||||
{
|
||||
readyEvent = new ManualResetEvent (false);
|
||||
mainEvent = new ManualResetEvent (false);
|
||||
@ -25,6 +24,9 @@ namespace MonoTests.System.Net.Sockets
|
||||
ThreadPool.QueueUserWorkItem (_ => DoWork ());
|
||||
readyEvent.WaitOne ();
|
||||
|
||||
if (error != null)
|
||||
throw error;
|
||||
|
||||
clientSocket = new Socket (
|
||||
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
clientSocket.Connect (serverSocket.LocalEndPoint);
|
||||
@ -42,18 +44,22 @@ namespace MonoTests.System.Net.Sockets
|
||||
|
||||
void DoWork ()
|
||||
{
|
||||
serverSocket = new Socket (
|
||||
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
|
||||
serverSocket.Listen (1);
|
||||
try {
|
||||
serverSocket = new Socket (
|
||||
AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
|
||||
serverSocket.Listen (1);
|
||||
|
||||
var async = new SocketAsyncEventArgs ();
|
||||
async.Completed += (s,e) => OnAccepted (e);
|
||||
var async = new SocketAsyncEventArgs ();
|
||||
async.Completed += (s,e) => OnAccepted (e);
|
||||
|
||||
readyEvent.Set ();
|
||||
|
||||
if (!serverSocket.AcceptAsync (async))
|
||||
OnAccepted (async);
|
||||
if (!serverSocket.AcceptAsync (async))
|
||||
OnAccepted (async);
|
||||
} catch (Exception e) {
|
||||
error = e;
|
||||
} finally {
|
||||
readyEvent.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
void OnAccepted (SocketAsyncEventArgs e)
|
||||
@ -92,8 +98,12 @@ namespace MonoTests.System.Net.Sockets
|
||||
|
||||
[Test]
|
||||
[Category("Test")]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void SendAsync ()
|
||||
{
|
||||
SetUp ();
|
||||
var buffer = new byte [] { 0x12, 0x34, 0x56, 0x78 };
|
||||
var m = new ManualResetEvent (false);
|
||||
var e = new SocketAsyncEventArgs ();
|
||||
|
Reference in New Issue
Block a user