3 edited title
| link

I want How to write a HTTP server, how do I do this?

2 personal and meta stuff removed
source | link

As the title says, I would like to write a HTTP server. My question is this, how do I do this? I know this sounds VERY general and too "high level", but there is a method to my madness. An answer to this question should be, I believe, language agnostic; meaning, no matter what language I use (e.g., C, C++, Java, etc.) the answer should be the same. I have a general idea of how this is supposed to work:

  1. Open a socket on port 80.
  2. Wait for a client to make a request.
  3. Read the request (i.e., this person wants page "contact-us.html").
  4. Find and read "contact-us.html".
  5. Send an html header, then send the content of "contact-us.html"
  6. Done

Like I said, I believe this is the process, but I am not 100% sure. This leads me to the heart of my question. How or where does a person find out this information? 

What if I didn't want to write just an HTTP server, what if I wanted to write an FTP server, a chat server, an image viewer, etc.? How does a person find out the exact steps/process needed to create a working HTTP server? 

A co-worker told me about the html header, so I would have NEVER know this without him. He also said something about handing off each request to a new thread. Is there some big book of how things work? Is there some manual of what it takes to be an HTTP server? 

I tried googling "how does a HTTP server work", but the only answers I could find were geared towards your average Joe, and not towards a person wanting to program a HTTP server.

Anyway, I hope I haven't confused everybody, and I hope I got my question across successfully. If not, ask and I'll try to elaborate more.

Thanks for reading, and have a great day. :-)

As the title says, I would like to write a HTTP server. My question is this, how do I do this? I know this sounds VERY general and too "high level", but there is a method to my madness. An answer to this question should be, I believe, language agnostic; meaning, no matter what language I use (e.g., C, C++, Java, etc.) the answer should be the same. I have a general idea of how this is supposed to work:

  1. Open a socket on port 80.
  2. Wait for a client to make a request.
  3. Read the request (i.e., this person wants page "contact-us.html").
  4. Find and read "contact-us.html".
  5. Send an html header, then send the content of "contact-us.html"
  6. Done

Like I said, I believe this is the process, but I am not 100% sure. This leads me to the heart of my question. How or where does a person find out this information? What if I didn't want to write just an HTTP server, what if I wanted to write an FTP server, a chat server, an image viewer, etc.? How does a person find out the exact steps/process needed to create a working HTTP server? A co-worker told me about the html header, so I would have NEVER know this without him. He also said something about handing off each request to a new thread. Is there some big book of how things work? Is there some manual of what it takes to be an HTTP server? I tried googling "how does a HTTP server work", but the only answers I could find were geared towards your average Joe, and not towards a person wanting to program a HTTP server.

Anyway, I hope I haven't confused everybody, and I hope I got my question across successfully. If not, ask and I'll try to elaborate more.

Thanks for reading, and have a great day. :-)

As the title says, I would like to write a HTTP server. My question is this, how do I do this? I know this sounds VERY general and too "high level", but there is a method to my madness. An answer to this question should be, I believe, language agnostic; meaning, no matter what language I use (e.g., C, C++, Java, etc.) the answer should be the same. I have a general idea of how this is supposed to work:

  1. Open a socket on port 80.
  2. Wait for a client to make a request.
  3. Read the request (i.e., this person wants page "contact-us.html").
  4. Find and read "contact-us.html".
  5. Send an html header, then send the content of "contact-us.html"
  6. Done

Like I said, I believe this is the process, but I am not 100% sure. This leads me to the heart of my question. How or where does a person find out this information? 

What if I didn't want to write just an HTTP server, what if I wanted to write an FTP server, a chat server, an image viewer, etc.? How does a person find out the exact steps/process needed to create a working HTTP server? 

A co-worker told me about the html header, so I would have NEVER know this without him. He also said something about handing off each request to a new thread. Is there some big book of how things work? Is there some manual of what it takes to be an HTTP server? 

I tried googling "how does a HTTP server work", but the only answers I could find were geared towards your average Joe, and not towards a person wanting to program a HTTP server.

1
source | link

I want to write a HTTP server, how do I do this?

As the title says, I would like to write a HTTP server. My question is this, how do I do this? I know this sounds VERY general and too "high level", but there is a method to my madness. An answer to this question should be, I believe, language agnostic; meaning, no matter what language I use (e.g., C, C++, Java, etc.) the answer should be the same. I have a general idea of how this is supposed to work:

  1. Open a socket on port 80.
  2. Wait for a client to make a request.
  3. Read the request (i.e., this person wants page "contact-us.html").
  4. Find and read "contact-us.html".
  5. Send an html header, then send the content of "contact-us.html"
  6. Done

Like I said, I believe this is the process, but I am not 100% sure. This leads me to the heart of my question. How or where does a person find out this information? What if I didn't want to write just an HTTP server, what if I wanted to write an FTP server, a chat server, an image viewer, etc.? How does a person find out the exact steps/process needed to create a working HTTP server? A co-worker told me about the html header, so I would have NEVER know this without him. He also said something about handing off each request to a new thread. Is there some big book of how things work? Is there some manual of what it takes to be an HTTP server? I tried googling "how does a HTTP server work", but the only answers I could find were geared towards your average Joe, and not towards a person wanting to program a HTTP server.

Anyway, I hope I haven't confused everybody, and I hope I got my question across successfully. If not, ask and I'll try to elaborate more.

Thanks for reading, and have a great day. :-)