Socket Network VB.Net Tutorial

Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Text
Imports System.Text.Encoding
Public Class Tester
    Public Shared Sub Main
        Dim serverIP As IPAddress = Dns.Resolve("www.rntsoft.com").AddressList(0)
        Dim Port As String = "80"
        Dim serverhost As New IPEndPoint(serverIP, Int32.Parse(Port))
    
        Dim clientSocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    
        Try
          clientSocket.Connect(serverhost)
    
          If clientSocket.Connected = False Then
            Console.WriteLine("Connect Error.")
            Exit Sub
          End If
    
          Dim httpReq As String = "GET / HTTP/1.0" & ControlChars.CrLf & ControlChars.CrLf
    
          clientSocket.Send(ASCII.GetBytes(httpReq))
    
          Dim buffer(1024) As Byte
          Dim byteCount As Int16 = clientSocket.Receive(buffer, buffer.Length, 0)
    
          Console.WriteLine(ASCII.GetString(buffer, 0, byteCount))
    
          Do While byteCount > 0
            byteCount = clientSocket.Receive(buffer, buffer.Length, 0)
            Console.WriteLine(ASCII.GetString(buffer, 0, byteCount))
          Loop
        Catch ex As Exception
          Console.WriteLine(ex.StackTrace.ToString())
        End Try
    
    End Sub
End Class