sender2.Connect("google.com", 80)
TextBox2.Text = ("Socket connected to {0}" & sender2.RemoteEndPoint.ToString())
' Encode the data string into a byte array.
Dim msg As String = ("POST / HTTP/1.1 \r\n" & Environment.NewLine & _
"Host: google.com \r\n" & Environment.NewLine & _
"Accept: */* \r\n>" & Environment.NewLine & _
"Content-Type: text/html \r\n" & Environment.NewLine & _
"Content-Length: 0 \r\n" & Environment.NewLine)
' Send the data through the socket.
Dim bytesSent As Integer = sender2.Send(Encoding.ASCII.GetBytes(msg))
TextBox1.Text = msg
' Receive the response from the remote device.
Dim bytesRec As Integer = sender2.Receive(bytes)
TextBox2.Text = ("Echoed test = {0}" & Encoding.ASCII.GetString(bytes, 0, bytesRec))
' Release the socket.
sender2.Shutdown(SocketShutdown.Both)
sender2.Close()
sender2 = Nothing