by ax3L (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 24th September 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This is an example of "how to use winsock control". The socket gets data from server, where we have java script file, and load it into a
API Declarations
Public Buffer$
Dim gBot As String
Dim bData() As String
Function bot() As String
Dim myVar, iList As ListItem
gBot = Buffer
gBot = Mid(gBot, InStr(gBot, "Array([") + 7)
gBot = Mid(gBot, 1, InStr(gBot, "]);"))
For Each myVar In Split(gBot, "],[")
bData = Split(myVar, ",")
bData(0) = Trim(Replace(bData(0), "'", ""))
Set iList = Form1.ListView1.ListItems.Add(, , bData(0))
Next
End Function
'CREATE 1 LISTVIEW OF FORM, PUT 1 WINSOCK
'CODE FOR FORM
Option Explicit
'creado por d4rk
Private Sub Form_Load()
ListView1.ListItems.Clear
Winsock1.Close
Winsock1.Connect "usuarios.lycos.es", 80
End Sub
Private Sub ListView1_BeforeLabelEdit(Cancel As Integer)
End Sub
Private Sub Winsock1_Close()
Call bot
End Sub
Private Sub Winsock1_Connect()
'No modificar cadena de JS!!
Buffer = Empty
Winsock1.SendData ("GET /d4rksoft/bots.js" & " HTTP/1.1" & vbCrLf _
& "Accept: */*" & vbCrLf & "Accept: text/html" & vbCrLf & "Host: usuarios.lycos.es" & vbCrLf & vbCrLf)
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim dt$
If Winsock1.State = sckConnected Then Winsock1.GetData dt
Buffer = Buffer & dt
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
End Sub
No comments have been posted about This is an example of how to use winsock control. The socket gets data from server, where we have. Why not be the first to post a comment about This is an example of how to use winsock control. The socket gets data from server, where we have.