Hope this code helps you.
Winsock Component - Using with VB.NET
Retrieving web page source, using OstroSoft Winsock Component (oswinsck.dll)
Download project source code
Minimum requirements: Visual Basic.NET, oswinsck.dll*
* If you don't have OstroSoft Winsock Component, see installation instructions
1. In Visual Studio.NET create new Visual Basic Windows Application.
2. Click on Project menu and select "Add Reference".
3. In "Add Reference" dialog box click on COM tab and select OSWinsck. Click OK to save a new reference.
4. Enter the following code:
Public Class frmMain
Inherits System.Windows.Forms.Form
Dim sPage As String
Dim WithEvents wsTCP As New OSWINSCK.Winsock
#Region " Windows Form Designer generated code "
Private Sub cmdView_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cmdView.Click
On Error GoTo ErrHandler
Dim sServer As String
Dim nPort As Long
nPort = 80
sServer = Trim(txtURL.Text)
If InStr(sServer, "://") > 0 Then _
sServer = Mid(sServer, InStr(sServer, "://") + 3)
If InStr(sServer, "/") > 0 Then
sPage = Mid(sServer, InStr(sServer, "/") + 1)
sServer = Strings.Left(sServer, InStr(sServer, "/") - 1)
End If
If InStr(sServer, ":") > 0 Then
nPort = Mid(sServer, InStr(sServer, ":") + 1)
sServer = Strings.Left(sServer, InStr(sServer, ":") - 1)
End If
If sServer = "" Then Err.Raise(12001, , "Invalid URL")
wsTCP.Connect(sServer, CInt(nPort))
Exit Sub
ErrHandler:
MsgBox("Error " & Err.Number & ": " & Err.Description)
End Sub
Private Sub wsTCP_OnClose() Handles wsTCP.OnClose
wsTCP.CloseWinsock()
End Sub
Private Sub wsTCP_OnConnect() Handles wsTCP.OnConnect
wsTCP.SendData("GET /" & sPage & " HTTP/1.0" & vbCrLf & vbCrLf)
End Sub
Private Sub wsTCP_OnDataArrival(ByVal bytesTotal As Integer) _
Handles wsTCP.OnDataArrival
Dim sBuffer As String
wsTCP.GetData(sBuffer)
txtSource.Text = txtSource.Text & sBuffer
End Sub
Private Sub wsTCP_OnError(ByVal Number As Short, _
ByRef Description As String, ByVal Scode As Integer, _
ByVal Source As String, ByVal HelpFile As String, _
ByVal HelpContext As Integer, ByRef CancelDisplay As Boolean) _
Handles wsTCP.OnError
MsgBox(Number & ": " & Description)
End Sub
Private Sub wsTCP_OnStatusChanged(ByVal Status As String) _
Handles wsTCP.OnStatusChanged
Console.WriteLine(Status)
End Sub
End Class