I have a .Net class that I amwriting to send and receive some information thru SSL with a 3rd party vendor.
I am using the HTTPWebRequest / HTTPWebResponse objects to accomplish this.
One thing is that I am being told by the vendor thatI am to send a three seperate packets "on the same connection".
In other words :
1) create the request
2) send packet A
3) read the response
4) send packed B
5) read the response
6) send packet C
7) read the response
7) close
This doesn't seem to make sense to me since the request is created and then whatever headers are created.This includes a Content-Length header that changes with each packet sent.
As long as I send just one packet, the code works perfectly. I have not been able to figure out how to send a second packet without createing a new HTTPWebRequest.
Here's the code that works with the 1 packet.
I need to know how to alter this code to do the 7 steps mentioned above. It may not be possible but, since they (my vendor) havesuggested that this is howthey 'need' the data,
oHTTPSRequest =
DirectCast(HttpWebRequest.Create(<MyURLHere>), HttpWebRequest)
sPacket = Me.CreateRequestPacket(voRequest)
Debug.Print(sPacket)
'ViewRawPacket(sPacket)
'Create the packet bytes from the ASCII encoder
btRequest = oEncoding.GetBytes(sPacket)
'Create the HTTPS Request header
GenerateRequestHeader(oHTTPSRequest, btRequest.Length)
'Get the stream from the request to write to
oRequestStream = oHTTPSRequest.GetRequestStream()
oRequestStream.Write(btRequest, 0, btRequest.Length)
oRequestStream.Close()
'Wait for the response from the request
oHTTPSResponse =
DirectCast(oHTTPSRequest.GetResponse(), HttpWebResponse)
'Create a stream reader from the response object and encode it as ASCII
oResponseStream =
New StreamReader(oHTTPSResponse.GetResponseStream(), System.Text.Encoding.ASCII)
'Read it into a string
sResponseText = oResponseStream.ReadToEnd
'ViewRawPacket(sResponseText)
Debug.Print(sResponseText)