Programming Home Computer For Use As A Server

I want to utilize a home computer to loosen the limitations on what my website can do. I have full access to configuring my home router (for things such as port forwarding if needed).

So, is there a simple way that I could send a http request to my computer at home. Like (for example), is there an IPv6 address that would carry the http request to my computer at home (would I have to configure my router for something like port forwarding), and if so then how would I go about obtaining it.

But, my biggest C++ questions are this. How could I setup Curl to use and respond to the http request without having to start a new process with each request, rather adding the request to a queue in the same process. Also, would it be possible to send a keep-alive to prevent the http request from timing out in case if my home computer is flooded with requests and needs some time to process them.

Another big question I have is can I practically (without having to rewrite all the libraries) cut out the middle man (the windows OS). So, could I emulate the OS calls and embed what the svchost.exe's (that do the networking) do so that my program could solely run on the hardware with nothing else running to maximize the capacity of the CPU, IO'ing, and especially RAM. And, how would I get the terminal window working without an OS to sit on.

Finally, how would I go about raw-writing/raw-reading the bytes on a physical drive, and how would I do it for a hard disk partition.


Thank you everyone who replies, all feedback and posts are graciously accepted.
Last edited on
You would need to be running a server that can handle http requests if you wish to host a website. I recommend Ruby on Rails, Apache, or Nginx. Since you are on Windows, I think Apache would be the best fit.
https://httpd.apache.org/docs/current/platform/windows.html

You will need to copy all of your webserver code to an htdocs folder once Apache is up and going. If you want to use PHP with Apache, that is a seperate download. Unless you go the WAMP route. http://www.wampserver.com/en/ WAMP comes with Apache and PHP bundled together. Most beginners learning about web servers start here on Windows.

So, is there a simple way that I could send a http request to my computer at home. Like (for example), is there an ipv6 address that would carry the http request to my computer at home (would I have to configure my router for something like port forwarding), and if so then how would I go about obtaining it.

I recommend a free dynamic dns name for whatever machine you plan to host your website on at home. Something like https://freedns.afraid.org/domain/ . With a dynamic dns, you would not need to memorize an IP address. Instead, you would memorize something.something.something in word form. Much easier, to remeber in my opinion. Also, if your IP address ever changes and your server is running a client that automatically updates the dynamic dns every 5 minutes or so, you will have no worries about accessing your server.

(for things such as port forwarding if needed).

Port 80 is the port you will need to free on your router's NAT. (Unless you change the configured port number in Apache's configuration file)

But, my biggest C++ questions are this. How could I setup Curl to use and respond to the http request without having to start a new process with each request, rather adding the request to a cross-thread (passed by reference) queue in the same process. Also, would it be possible to send a keep-alive to prevent the http request from timing out incase if my home computer is flooded with requests and needs some time to process them.

Another big question I have is can I practically (without having to rewrite all the libraries) cut out the middle man (the windows OS). So, could I emulate the OS calls and embed what the svchost.exe's (that do the networking) do so that my program could solely run on the hardware with nothing else running to maximise the capacity of the CPU, IO'ing, and especially RAM. And, how would I get the terminal window working without an OS to sit on.

Finally, how would I go about raw-writing/raw-reading the bytes on a physical drive, and how would I do it for a hard disk partition.

Sorry, not touching this with a ten foot pole.
Last edited on
Thank you so much, you are so incredibly helpful, you have answered all of my questions. I love your ironic humor of, "Sorry, not touching this with a ten foot pole."
Last edited on
Thank you so much, you are so incredibly helpful.
Sarcasm?

I plan on eventually getting down to the electricity that runs through the wires
I cannot decide if you are trolling or serious... If you are serious, why would you want to redesign the entire computer just to make a web server?

I did not come here to post about how to setup a server using Apache
But you did come here to setup a web server, no? Maybe you would rather compile your own web server from source code first, and then perhaps use that as an example while designing your own. When designing your own, you will need to ensure that your web server can handle many of the RFCs listed in this stack overflow answer.
http://stackoverflow.com/a/176422/2607949

my server will be doing things that would be incredibly inefficient if programmed in server scripting languages

Yet major sites use programs like Apache or Nginx to serve thousands or millions of requests per second...

The section of your question that I would not touch with a ten foot pole, is very unecessary. You are completely redesigning the computer, simply to create a web server. It is obvious you lack the experience or knowledge of how internet pages in web browsers actually work. You are starting down a path that could take you through the entire history of computers. Your dream web server could take you many years to build... Or perhaps longer. Electricity on wires, raw-writing/raw-reading of the hard drive, my program could solely run on the hardware, etc. Those operations require writing low level drivers that interface with the hardware or designing the hardware entirely. You also need to write your own operating system to replace Windows entirely for your dream web server. A computer needs an operating system, even if it is so basic as to only run a web server. And you will need a bootloader most likely to fully fulfill your dream. A bootloader handles the baby processor when it first turns on and makes it into an adult that can do all of the things it needs to. (Weird explanation, but that's basically what the boot loader does.)

Can you see why I would not touch that with a ten foot pole now? I do not want to lose many years of my life. At least with today's computers you can run virtualized machines to simulate your dream web server... That may shave soem years away from the total.

Should you decide to be more reasonable, take a serious look at that stackoverflow link I posted and give that a go first.
Thank you so much, you are incredibly helpful. You have answered all of my questions and then some, so I do not know how to put this into words other than simply, thank you.
Topic archived. No new replies allowed.