hi guys, how do i create a simple server that ships alongside my windows app during installation which will be used as local server to host web pages that ships along with the Windows app.

"to host web pages".

If they're HTML, CSS and JavaScript, you don't need any single local-server. Just merge these 3 together in one file and obfuscate it (won't give a lot, but definitely would help). And make sure your Windows App opens in by just refering to the file.

If you're having C#/.NET/PHP application that you need server for. I'd "disrecommend" it. If I were you, I'd create AJAX responses to your server (somewhere entirely else) and get answers and showing them to users by JavaScript/jQuery. It will keep source-code of your files safe, meanwhile still providing answer.

Make sure you're still protecting yourself against things like DDoS, faulty delimiters or exceptions on server.

Sending the code along with the app may, or may not be an issue. HTML, CSS, and JavaScript are all transmitted to the client, where the source can be read quite easily. Are you worried about the backend being copied by competitors? If you have sensitive business backend code, then probably just use your own web server. If you decide to code a local one on the customer device whatever web server you code will only be visible to the local net. You basically need to learn about sockets. I know that Elitte Rusty Harold's book Java Network Programming 4th edition has a couple of web servers in it (I know, not the right language, but this book does contain a web server example or two, or more). You could probably at least get a good idea of how to code it from the source code there. I know that it is possible to code a simple C# server, and the examples on the book website should be simple enough to port.

Click Here

Once you understand it is simply a server socket, and a text protocol, you are like OMG, it's that simple? And the threading in his examples is very well thought out and straight forward. I really enjoyed the book.

Source code is located at this site:
Click Here

I can see situations where he may not be giving away code which is very vital, for example a web compiler, or some tool, or a help app, then again, if you are sending backend code, then make sure that you don't mind other people using it for their own purposes. Even compiled it can be reversed.

What I don't necissarily understand is how the big names in web servers manage to post ftp, and other types of files like PDFs you can read inside the browser.