For i As Integer = 0 To 99
Dim JJ As New jobject
JJ("EventCode") = "CustomerAddedOrChanged"
JJ("CustomerInfo") = "dfs Jo"
' 发送信息
Dim postData As String = CompressJson(JJ.Tostring)
Dim request As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create("http://192.168.2.6/test"), System.Net.HttpWebRequest)
request.Method = "POST"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.accept = "application/json"
request.ContentLength = byteArray.Length
request.Timeout = 3000 ' 3秒
Dim ReoToken As String = "asdfsadfgghfgd"
request.Headers.Add("Authorization", ReoToken) 'base64 加密
Dim dataStream As System.IO.Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As System.Net.HttpWebResponse = CType(request.GetResponse(), System.Net.HttpWebResponse)
Dim responseStream As System.IO.Stream = response.GetResponseStream()
Dim reader As New System.IO.StreamReader(responseStream, Encoding.UTF8)
Dim responseContent As String = reader.ReadToEnd()
Dim statusCode = response.StatusCode
responseStream.Close()
response.Close()
Output.Show(i & ": " & statusCode)
Output.Show(responseContent)
Next