privoli
Apr 11th, 2000, 02:00 PM
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
me.caption = "Downloading..."
Winsock1.getdata TempStr, vbString
text1.text = text1.text & TempStr
' you will need to add your own code to check for a string
' that contains "content-lenght=" which has the file size after it...
End Sub
Private Sub Winsock1_Close()
'its complete, the httpd server automatically closes the connection
'when the file get is complete :)
me.caption = "Download complete."
End Sub
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
me.caption = "Downloading..."
Winsock1.getdata TempStr, vbString
text1.text = text1.text & TempStr
' you will need to add your own code to check for a string
' that contains "content-lenght=" which has the file size after it...
End Sub
Private Sub Winsock1_Close()
'its complete, the httpd server automatically closes the connection
'when the file get is complete :)
me.caption = "Download complete."
End Sub