Winsock getdata after post method - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Winsock getdata after post method

nattsurf123nattsurf123 Posts: 4Member
Hi,
I have some problem receiving data with GetData after using post method. GetData returns nothing.
I have installed fiddler the ip-sniffer to se what happends. Fiddler seams to receive data without any problem for the request.

Appreciate your help.

Here is the code I use:
Dim retData As String
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub DoSleep()
Sleep (1000)
End Sub


Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
'Junk code for break point.
Dim dong As Long
dong = 5
End Sub



Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Winsock1.GetData (Data)
retData = retData & Data
Dim x As Integer
x = 5

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
Private Sub Submit_Click()
'MsgBox (Me.ContentControls(1).Range.Text)
retData = Empty
Winsock1.Close

If Winsock1.State = sckDisconnected Then
Winsock1.RemoteHost = "127.0.0.1"
'Winsock1.LocalPort = 8080

'Set to 80 if you don't use ip sniffer.
Winsock1.RemotePort = 8888
Winsock1.Connect

If Winsock1.State = sckDisconnected Then
MsgBox ("Not connected")
Else
Dim abc As String
abc = "test=34"
For i = 0 To 5
If Winsock1.State = sckConnected Then
Exit For
End If
DoSleep
DoEvents
Next




'Winsock1.SendData ("POST /index.php HTTP/1.1")
Winsock1.SendData ("POST /index.php HTTP/1.1" & vbCrLf & _
"Host: " & "127.0.0.1" & ":80" & vbCrLf & vbCrLf)
'"Content-Length: " & Len(abc) & vbCrLf & _
'"Connection: Keep-Alive" & vbCrLf & _
'vbCrLf & abc & vbCrLf)

For i = 0 To 5
If Len(retData) > 0 Then
Exit For
End If
DoSleep
DoEvents
Next


'Winsock1.GetData (msg)
'MsgBox (msg)
End If
End If

End Sub
Sign In or Register to comment.