Results 1 to 2 of 2

Thread: Downloading files!!! Please HELP!!!!!!

  1. #1

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134

    Question

    Anyone who knows how to download a file using the winsock control? I want to download a file, detect when the download is completed and show the percentage downloaded.

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126
    A sample winsock application. Connects to a webserver and downloads a .html file...

    Create a new form...

    Add a text box caled "Text1"
    Add a command button called "Command1"
    Add a winsock control called "Winsock1"

    Set Text1 to MultiLine = True and ScrollBars = Both

    Private Sub Command1_Clik()
    'connect to server
    Winsock1.connect "www.vb-world.net", 80
    End Sub

    Private Sub Winsock1_Connect()
    'send http request (ask for the file)
    Winsock1.senddata "GET /index.html HTTP/1.0" & vbclrf & vbcrlf
    End Sub

    Private Sub Winsock1_DataArrival(bytes as long)
    'weve recieved a packet, keep track of it and add it to the text box
    Winsock1.getdata TempStr, vbString
    text1.text = text1.text & TempStr
    End Sub

    Private Sub Winsock1_Close()
    'its complete, the httpd server automatically closes the connection
    'when the file get is complete
    msgbox "Download complete."
    End Sub
    Regards,

    Paul Rivoli
    ---------------------
    [email protected]
    http://members.dingoblue.net.au/~privoli

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