I am writing a server-side program.
I created a HttpListener
to listen for incoming requests.
How can I find out what kind of data is being sent in? E.g. is it a text, image, pdf, word?
Pls correct my code below if it is wrong. I'm really new to this and my understanding of the HTTP concepts may be wrong. Thanks.
main()
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://192.168.1.2/");
listener.Start();
while (true) //Keep on listening
{
context = listener.GetContext();
HttpListenerRequest request = context.Request;
//Do I get the request stream here, and do something with the stream to find out what data format is being sent?
Stream requestStream = request.InputStream;
}
}