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:
  1. Dim Url() As String
  2.  
  3. Public Sub beginana_Click(index As Integer)
  4. Dim loop As Integer
  5.  
  6. 'Contains a list of URL's
  7. ReDim Url(urlq.ListCount) As String
  8.  
  9. For loop = 0 To urlq.ListCount
  10. Url(loop) = urlq.List(loop)
  11. Next loop
  12.  
  13. 'Call process and send zero to addloc
  14. process(0)
  15. End Sub
  16.  
  17. Private Sub process(addloc As Single)
  18.  
  19.     With mainfrm.mkt
  20.         .Close
  21.         .LocalPort = 0
  22.     End With
  23.    
  24.     'Set address to be worked upon (workind is a global string in module       ' 'UrlList)
  25.     UrlList.workind = addloc
  26.     'Set the remote host/port
  27.     mkt.RemoteHost = Url(addloc)
  28.     mkt.RemotePort = 80
  29.     mkt.Connect
  30.    
  31. End Sub
  32.  
  33. Private Sub mkt_Connect()
  34. MsgBox ("")
  35.     packet = "GET / HTTP/1.1" & vbNewLine
  36.     packet = packet & "Host: " & Mid(Url(UrlList.workind), 8, Len(Url(UrlList.workind)) - 7) & vbNewLine
  37.     'Add packet terminator
  38.     packet = packet & vbNewLine
  39.    
  40.     'Send data request
  41.     mkt.SendData (packet)
  42. 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