Dim tcpClient As New System.Net.Sockets.TcpClient() Dim result = tcpClient.BeginConnect(serverIP, serverPort, Nothing, Nothing) Dim check As Boolean = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5))