943,816 Members | Top Members by Rank

Ad:
Jun 25th, 2009
0

Winsock getdata after post method

Expand Post »
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:
vb Syntax (Toggle Plain Text)
  1. Dim retData As String
  2. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  3.  
  4. Private Sub DoSleep()
  5. Sleep (1000)
  6. End Sub
  7.  
  8.  
  9. Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
  10. 'Junk code for break point.
  11. Dim dong As Long
  12. dong = 5
  13. End Sub
  14.  
  15.  
  16.  
  17. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  18. Dim Data As String
  19. Winsock1.GetData (Data)
  20. retData = retData & Data
  21. Dim x As Integer
  22. x = 5
  23.  
  24. End Sub
  25. 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)
  26. Winsock1.Close
  27. End Sub
  28. Private Sub Submit_Click()
  29. 'MsgBox (Me.ContentControls(1).Range.Text)
  30. retData = Empty
  31. Winsock1.Close
  32.  
  33. If Winsock1.State = sckDisconnected Then
  34. Winsock1.RemoteHost = "127.0.0.1"
  35. 'Winsock1.LocalPort = 8080
  36.  
  37. 'Set to 80 if you don't use ip sniffer.
  38. Winsock1.RemotePort = 8888
  39. Winsock1.Connect
  40.  
  41. If Winsock1.State = sckDisconnected Then
  42. MsgBox ("Not connected")
  43. Else
  44. Dim abc As String
  45. abc = "test=34"
  46. For i = 0 To 5
  47. If Winsock1.State = sckConnected Then
  48. Exit For
  49. End If
  50. DoSleep
  51. DoEvents
  52. Next
  53.  
  54.  
  55.  
  56.  
  57. 'Winsock1.SendData ("POST /index.php HTTP/1.1")
  58. Winsock1.SendData ("POST /index.php HTTP/1.1" & vbCrLf & _
  59. "Host: " & "127.0.0.1" & ":80" & vbCrLf & vbCrLf)
  60. '"Content-Length: " & Len(abc) & vbCrLf & _
  61. '"Connection: Keep-Alive" & vbCrLf & _
  62. 'vbCrLf & abc & vbCrLf)
  63.  
  64. For i = 0 To 5
  65. If Len(retData) > 0 Then
  66. Exit For
  67. End If
  68. DoSleep
  69. DoEvents
  70. Next
  71.  
  72.  
  73. 'Winsock1.GetData (msg)
  74. 'MsgBox (msg)
  75. End If
  76. End If
  77.  
  78. End Sub
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nattsurf123 is offline Offline
7 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: New some advise on creating the table.
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to insert the text on a new line?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC