Hi,
I have run across a strange problem when trying to request a webpage using winsock. Any help would be useful. My code is as follows:
VB Code:
Dim Url() As String Public Sub beginana_Click(index As Integer) Dim loop As Integer 'Contains a list of URL's ReDim Url(urlq.ListCount) As String For loop = 0 To urlq.ListCount Url(loop) = urlq.List(loop) Next loop 'Call process and send zero to addloc process(0) End Sub Private Sub process(addloc As Single) With mainfrm.mkt .Close .LocalPort = 0 End With 'Set address to be worked upon (workind is a global string in module ' 'UrlList) UrlList.workind = addloc 'Set the remote host/port mkt.RemoteHost = Url(addloc) mkt.RemotePort = 80 mkt.Connect End Sub Private Sub mkt_Connect() MsgBox ("") packet = "GET / HTTP/1.1" & vbNewLine packet = packet & "Host: " & Mid(Url(UrlList.workind), 8, Len(Url(UrlList.workind)) - 7) & vbNewLine 'Add packet terminator packet = packet & vbNewLine 'Send data request mkt.SendData (packet) End Sub
The msgbox never fires and the following error occurs:
11004 Valid name, no data record of requested type -2146817284 C:\WINDOWS\system32\MSWINSCK.OCX 0
On debugging Url(addloc) = "http://www.google.co.uk" and Mid(Url(UrlList.workind), 8, Len(Url(UrlList.workind)) - 7) = "www.google.co.uk" (which is how it should be).
Does anyone have any ideas of what i'm doing wrong?
Jord




Reply With Quote