|
-
Nov 23rd, 1999, 04:47 AM
#1
Thread Starter
PowerPoster
Who finds the winsock control a pain the in the %?*/&£? I do!
Ok, this code downloads a TEXT file perfectly from an FTP server, but NOT a binary file (like a GIF which I tried it on). Any ideas...
(Declarations of form)
Dim webData As Byte
Private Sub Winsock1_Connect()
Dim strSizeCmd As String
Dim strCommand As String
Dim strWebPage As String
strWebPage = "http://www.desktopdriving.co.uk/Graphics/Graphics/Motor_Car.gif"
strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf
strCommand = strCommand + "Accept: */*" + vbCrLf
strCommand = strCommand + "Accept: text/html" + vbCrLf
strCommand = strCommand + vbCrLf
Winsock1.SendData strCommand
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
' I have tried vbString also...
Winsock1.GetData webData, vbByte
End Sub
Private Sub Winsock1_Close()
Dim intFile As Integer
intFile = FreeFile()
Open "C:\Motor_Car.gif" For Binary Access Write As #intFile
Put #intFile, , webData
Close #intFile
End Sub
As i said, this works fine for text files when you modify the Byte bits (programmer humour! ) to strings, but I need to get binary files like and exe! Any clues guys..thanks.
Kind regards,
------------------
- Chris
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|