Public Sub callbackConnect(ByVal ar As IAsyncResult) Dim client As Socket = CType(ar.AsyncState, Socket) client.EndConnect(ar) End Sub
Public Function connetct() As Boolean Try g_client = New TcpClient g_client.beginConnect(g_StrIpAdr, g_iPort, New AsyncCallback(AddressOf callbackConnect), g_client) Return True Catch ex As Exception Return False End Try End Function