Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Tester
Dim Shared myTcpListener As TcpListener
Public Shared Sub Main
Dim myThread As New Thread(New ThreadStart(AddressOf StartListen))
myThread.Start()
End Sub
Private Shared Sub StartListen()
myTcpListener = New TcpListener(12334)
Dim blnConection As Boolean = False
Try
myTcpListener.Start()
Dim mySocket As Socket = myTcpListener.AcceptSocket()
Do
If mySocket.Connected = True Then blnConection = True
Loop Until blnConection = True
myTcpListener.Stop()
Catch ex As SocketException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class