Kent

Kent

  • NA
  • 2
  • 2.8k

Reading incoming POST and sending GET commands in C#

Nov 4 2013 1:37 PM
I'm a C3 novice.  I have primarily C coded.  I have a problem, that I hope you can give me some insight  and/or code snippets.

Problem:  We have GUI software written in C# that communicates with LRUs (line replaceable units) for the purpose of loading and retrieving data.  I have a LRU server that currently uses HTTP POST commands to transfer data to a laptop server.  The laptop currently accepts that LRU POST data and displays in a web page.  The laptop also uses POST and GET commands to the LRU, inorder to set and retrieve LRU values.  I want to us a different laptop configured with our software to perform the same tasks.  Our laptop displays the data in GUI windows and doesn't use a web browser interface

1.  Do you have C# code examples to illustrate how our laptop might receive the following periodic HTTP POST data command from the LRU:  i.e.  POST /mipg3/servlet/XmlToMySql  HTTP/1.0?

Below is a snippet from a Wireshark network analysis of sample communication between the LRU and laptop (that uses the web interface with the LRU).

192.168.211.1          192.168.211.143     HTTP     POST /mipg3/servlet/XmlToMySql  HTTP/1.0
192.168.211.143      192.168.211.1         HTTP     HTTP/1.0  200 OK
192.168.211.1          192.168.211.143     HTTP     POST /mipg3/servlet/XmlToMYSql  HTTP/1.0 
192.168.211.143      192.168.211.1         HTTP     HTTP/1.0  200 OK
192.168.211.143      192.168.211.1         HTTP     GET /setFreq.shtml  HTTP/1.1
192.168.211.1          192.168.211.143     HTTP     POST /mipg3/servlet/XmlToMySql  HTTP/1.0

I'm not sure if the WebResponse class with GetResponseStream() is what should be used to read these incoming LRU POSTs.
I'm also not sure if the WebRequest class with GetRequestStream() is what should be used to get an LRU POST.

Thank you very much for any assistance you can share,

-Willie