Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen to HTTP requests

Tags:

c#

http

webserver

I have a C# form application which I want to have listening for incoming HTTP requests from other computers.

How would I go about doing this?

like image 748
Egil Avatar asked Jul 18 '11 21:07

Egil


People also ask

How do I view HTTP requests in my browser?

To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.

How can I see HTTP request in Postman?

You can right click on the main Postman window > Inspect element. In the Network tab, you'll be able to see the request when you click the Send button. Clicking on the request in the Network tab will show you the response payload.

What are the 4 types of HTTP request methods?

The most commonly used HTTP request methods are GET, POST, PUT, PATCH, and DELETE.


1 Answers

For simple needs, the HttpListener class is a good and simple choice. There is an example on the linked MSDN page.

If, for some reason, you cannot use HttpListener, the process would be to listen to a port using TcpClient (or even the sockets API if you need the gritty details), and then implement the HTTP Protocol. I highly recommend HttpListener over rolling your own, unless you have specific requirements that HttpListener does not meet.

like image 79
driis Avatar answered Oct 17 '22 07:10

driis