Webresponse Question
-
I am trying to get a second response from a Webrequest. The server that I am talking to works as follows. First here is my code:
string postData = ""; // filled with xml request data Uri myUri = new Uri("http://208.XXX.XX.XXX:10224/?ReturnAddress=209.XX.XX.XX/recvpost.php"); HttpWebRequest h = (HttpWebRequest)WebRequest.Create(myUri); h.Method = "POST"; h.ContentType="text/xml"; h.ContentLength=postData.Length; Stream newStream = h.GetRequestStream(); newStream.Write(byte1,0,byte1.Length); newStream.Close(); WebResponse resp = h.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream()); string str = reader.ReadLine(); while(str != null) { Console.WriteLine(str); MessageBox.Show( str ); str = reader.ReadLine(); } resp.Close();
- Send your request, when received the replay "OK" will be sent. 2) Once the server has the request ready it will send the reply. 3) I am receiving the OK but nothing else. How do you get secondary responses?
-
I am trying to get a second response from a Webrequest. The server that I am talking to works as follows. First here is my code:
string postData = ""; // filled with xml request data Uri myUri = new Uri("http://208.XXX.XX.XXX:10224/?ReturnAddress=209.XX.XX.XX/recvpost.php"); HttpWebRequest h = (HttpWebRequest)WebRequest.Create(myUri); h.Method = "POST"; h.ContentType="text/xml"; h.ContentLength=postData.Length; Stream newStream = h.GetRequestStream(); newStream.Write(byte1,0,byte1.Length); newStream.Close(); WebResponse resp = h.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream()); string str = reader.ReadLine(); while(str != null) { Console.WriteLine(str); MessageBox.Show( str ); str = reader.ReadLine(); } resp.Close();
- Send your request, when received the replay "OK" will be sent. 2) Once the server has the request ready it will send the reply. 3) I am receiving the OK but nothing else. How do you get secondary responses?
-
What do you mean by a second response? Each request can have only one response. --- b { font-weight: normal; }
I was told by the server provider to send a Webrequest with the above mentioned header information. When the server receives the request it will send the OK reply, and then break the connection. When it has the reply ready it will call back on the ip address provided in the Uri and send the file noted in the Uri recvpost.php.
Uri myUri = new Uri("http://208.XXX.XX.XXX:10224/?**ReturnAddress=209.XX.XX.XX**/recvpost.php");
So, I guess I am asking how to I listen for that reply? -
I was told by the server provider to send a Webrequest with the above mentioned header information. When the server receives the request it will send the OK reply, and then break the connection. When it has the reply ready it will call back on the ip address provided in the Uri and send the file noted in the Uri recvpost.php.
Uri myUri = new Uri("http://208.XXX.XX.XXX:10224/?**ReturnAddress=209.XX.XX.XX**/recvpost.php");
So, I guess I am asking how to I listen for that reply?Ok you must be receiving as response code.. you have to receive webresponse stream to get the response form the requested uri. - ashish
-
Ok you must be receiving as response code.. you have to receive webresponse stream to get the response form the requested uri. - ashish
If you look at my above code snippit isn't that what I am doing?
WebResponse resp = h.GetResponse(); StreamReader reader = new StreamReader(resp.GetResponseStream());
If you mean something different could you please clarify?
-
I was told by the server provider to send a Webrequest with the above mentioned header information. When the server receives the request it will send the OK reply, and then break the connection. When it has the reply ready it will call back on the ip address provided in the Uri and send the file noted in the Uri recvpost.php.
Uri myUri = new Uri("http://208.XXX.XX.XXX:10224/?**ReturnAddress=209.XX.XX.XX**/recvpost.php");
So, I guess I am asking how to I listen for that reply?