Results 1 to 22 of 22

Thread: Winsock question

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    150

    Winsock question

    I got this code from a previous thread.

    But it does not seem to work for me it gets stuck in Do Unitl Winsock.state = 7 loop. Any ideas?

    VB Code:
    1. Private DLFile As String
    2.  
    3. Private Sub Command1_Click()
    4. Dim txtServer As String
    5. Dim txtFile As String
    6.  
    7. txtFile = "/operational/pibs/pib1.shtml"
    8. txtServer = "www.nats.co.uk"
    9.  
    10.     Winsock1.RemoteHost = txtServer
    11.     Winsock1.RemotePort = 80
    12.     Winsock1.Connect
    13.     Do Until Winsock1.State = 7
    14.         DoEvents
    15.     Loop
    16.     Winsock1.SendData "GET " & txtFile & " HTTP/1.1" & vbCrLf
    17.     DoEvents
    18.     Winsock1.SendData "Host: " & txtServer & vbCrLf
    19.     DoEvents
    20.     Winsock1.SendData vbCrLf
    21. End Sub
    22.  
    23. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    24.     Dim NewData As String
    25.     Winsock1.GetData NewData
    26.     DLFile = DLFile & NewData
    27.    
    28.     Debug.Print DLFile
    29. End Sub
    Last edited by Granger9; Mar 20th, 2006 at 04:50 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width