[RESOLVED] winsock, data receive
When I try to get data I get them in parts, i receive one part, another, and so on, so to get the source of the page i have to do like...
VB Code:
Winsock1.GetData Data2, vbString
Data = Data & Data2
Only... how do i figure out when to put Winsock1.Close?
When I add it after "Data = Data & Data2," I just get the first part/section of the html..
I can't do (below) because not all sites have it, and are maybe just a list of something uploaded onto a webserver..
VB Code:
If instr(data, "</html>") > 0 then winsock1.close
all of it...
VB Code:
Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect "profiles.yahoo.com", 80
End Sub
Private Sub winsock1_connect()
Winsock1.SendData "GET /auser HTTP/1.0" & vbCrLf & vbCrLf
End Sub
Private Sub winsock1_dataarrival(ByVal bytesTotal As Long)
Dim pdat As String
Winsock1.GetData pdat, vbString
RichTextBox1 = RichTextBox1.Text & pdat
End Sub
:confused:
Re: winsock, data receive
Actually, the remote server should close the connection once the data is done being sent. Drop in some code for the Winsock_Close sub.
VB Code:
Winsock1_Close()
Msgbox "Finished"
Winsock1.Close 'Just in case, you know?
End Sub
Re: winsock, data receive
yes you should put the .close method before the msgbox because it has a tendency to loop the msgbox otherwise. The close event would be where you would know all of the page has been received, so you can process the html
Re: winsock, data receive