开发者

Creating a web server that responds to every incoming request with a simple message

开发者 https://www.devze.com 2023-01-05 08:34 出处:网络
I\'d like to create a web server that responds to every incoming request with a simple开发者_C百科 \"Hello\" message in C#.

I'd like to create a web server that responds to every incoming request with a simple开发者_C百科 "Hello" message in C#.

How do I do that?


How much of it do you need to do from scratch? It's pretty simple to do this if you're allowed to use HttpListener.

Otherwise, you might want to look at TcpListener - accept a socket connection, read data from it, and write a response. Admittedly it's somewhat easier if you can answer every request with "Hello" as you don't need to really parse it...


You can read an article on CodeProject

http://www.codeproject.com/KB/IP/mywebserver.aspx

There is also a project on codeplex

http://webserver.codeplex.com/

You will need Sockets, Multithreading and the RFC http://www.faqs.org/rfcs/rfc2616.html

0

精彩评论

暂无评论...
验证码 换一张
取 消