Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1677
Number of posts: 4766

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Winsock getdata after post method Posted by nattsurf123 on 25 Jun 2009 at 5:40 AM
Winsock getdata after post method (Voting Closed)
I like turtles 0 Votes
 0%
I don't like turtles 0 Votes
 0%
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.