Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Basic Winsock Help


Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2005, 04:57 PM
xcannon xcannon is offline
Freshman
 
Join Date: Oct 2004
Posts: 32
Default Basic Winsock Help


Ok. I am making a wrapper in Winsock. I am new to winsock, after using iNet and Webbrowser in the past... and I have some problems. I have managed to get so far currently by myself... (not far :P) All I have currently done is enable winsock to go to a page.

My Problem:
I am returning the function as a string. So when a user users the control, I want the returned result to be the source of the page. I was wondering how I get it?

Current Code:
Code:
Public Function GetPage(ByVal URL As String, Optional ByVal Refferer As String) As String
    
    Dim strHost As String
        
    If URL = Empty Then
        Exit Function
    End If
 
    If LCase$(Left$(URL, 7)) = "http://" Then
        strHost = Mid$(URL, 8)
    Else
        strHost = URL
    End If

    If InStr(1, strHost, "/") Then
        strHost = Left$(strHost, InStr(1, strHost, "/") - 1)
    End If
    
    Winsock1.RemoteHost = strHost
    Winsock1.RemotePort = 80
    Winsock1.LocalPort = 0
    
    Winsock1.Connect
    
    Do Until Winsock1.State = 7: DoEvents: Loop

End Function
Help appreciated...

Thanks,
xcannon
Reply With Quote
  #2  
Old 12-11-2005, 09:01 AM
b0b b0b is offline
Contributor
 
Join Date: Jul 2003
Posts: 741
Default

You need to look at the HTTP protocol, more precisely GET requests.

HTTP:
http://www.w3.org/Protocols/rfc2616/rfc2616.html


Quote:
Do Until Winsock1.State = 7: DoEvents: Loop
You should also look at www.winsockvb.com, winsock has events you should be using.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->