Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Tester
Public Shared Sub Main
Dim myTcpClient As New TcpClient()
Try
myTcpClient.Connect("127.0.0.1", 1234)
Catch ex As ArgumentOutOfRangeException
Console.WriteLine(ex.Message)
Catch ex As SocketException
Console.WriteLine(ex.Message)
End Try
End Sub
End Class
No connection could be made because the target machine actively refused it