Sabrin
asked on
2 winsocks intro 1 winsock
hello,
I am using two winsock in my code but I would like to have only 1.
its not using the same one at the same time!
how can I do that??
Private Sub Winsock_Connect()
Winsock.SendData Login("user", "pass")
Label3.Caption = "Sending Login..."
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock.GetData data
txtURL1 = GetStringBetween(txtAnswer 1, "Location: ", "" & vbNewLine & "Set-Cookie:")
txtCookie = GetStringBetween(txtAnswer 1, "Set-Cookie: ", "" & vbNewLine & "Location:")
Label3.Caption = "Login ok..."
Winsock.Close
Winsock2.Connect
End Sub
Private Sub Winsock2_Connect()
Winsock.SendData Login2(txtURL1, txtCookie)
Label3.Caption = "Sending confirmation..."
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock.GetData data
If InStr(txtAnswer2, "loggedin.asp") Then
Label3.Caption = "Logged in!"
End If
If InStr(txtAnswer2, "error.asp") Then
Label3.Caption = "Login incorrect!"
End If
End Sub
I am using two winsock in my code but I would like to have only 1.
its not using the same one at the same time!
how can I do that??
Private Sub Winsock_Connect()
Winsock.SendData Login("user", "pass")
Label3.Caption = "Sending Login..."
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock.GetData data
txtURL1 = GetStringBetween(txtAnswer
txtCookie = GetStringBetween(txtAnswer
Label3.Caption = "Login ok..."
Winsock.Close
Winsock2.Connect
End Sub
Private Sub Winsock2_Connect()
Winsock.SendData Login2(txtURL1, txtCookie)
Label3.Caption = "Sending confirmation..."
End Sub
Private Sub Winsock2_DataArrival(ByVal
Dim data As String
Winsock.GetData data
If InStr(txtAnswer2, "loggedin.asp") Then
Label3.Caption = "Logged in!"
End If
If InStr(txtAnswer2, "error.asp") Then
Label3.Caption = "Login incorrect!"
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
However
Private Sub Winsock2_Connect()
' should it be Winsock2.SendData Login2(txtURL1, txtCookie)
Winsock.SendData Login2(txtURL1, txtCookie)
Label3.Caption = "Sending confirmation..."
End Sub
Private Sub Winsock2_DataArrival(ByVal
Dim data As String
' it should Winsock2.GetData data
Winsock.GetData data
If InStr(txtAnswer2, "loggedin.asp") Then
Label3.Caption = "Logged in!"
End If
If InStr(txtAnswer2, "error.asp") Then
Label3.Caption = "Login incorrect!"
End If
End Sub