Merge pull request #5504 from ntherning/wait-for-native-thread-to-die-in-Thread-Join
[mono.git] / mcs / class / Mono.Data.Tds / Test / bug-4786.cs
index e8436a7decacd4b7420cacf7f664f72a84062f5e..ed44567b40d019b14b7198a20c623f98a82449b1 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-namespace bug4786test
+namespace MonoTests.Mono.Data.Tds
 {
        
   using NUnit.Framework;
-  using Mono.Data.Tds.Protocol;
+  using global::Mono.Data.Tds.Protocol;
   using System;
   using System.Net;
   using System.Net.Sockets;
@@ -51,13 +51,10 @@ namespace bug4786test
        //require at this point: a listener on port 1433...
 
        try{
-               Socket Listener = new Socket(AddressFamily.InterNetwork, 
-                                         SocketType.Stream,
-                                         ProtocolType.Tcp);
                IPAddress hostIP =Dns.GetHostEntry("localhost").AddressList[0];
-               IPEndPoint ep = new IPEndPoint(hostIP, 1433);
-               Listener.Bind(ep); 
-               Listener.Listen(1);
+        IPEndPoint ep = new IPEndPoint(hostIP, 1433);
+        TcpListener Listener = new TcpListener (ep);
+        Listener.Start ();
        } catch (Exception){
                //ignore
        }
@@ -103,6 +100,7 @@ namespace bug4786test
 
        pool.ReleaseConnection(tds);
 
+       Listener.Stop ();
        //exit
     }
   }