0

My assignment is to implement a multithreaded web server in Java but i have no idea where to start. All we've seen in the lectures is how tcp works,layers etc.but i have no idea about how to implement a web server.

Can you give me a starting point?

3 Answers 3

3

Since you don't give much information just some links to helpful resources:

Sign up to request clarification or add additional context in comments.

Comments

0

First of all, you have to make choice about the programming language you want use. Several languages are particulary useful and more adapted for network programming. I thinking about Erlang for example.

Comments

0

You haven't mention which language should you use. I assumed C/C++.

First, you can look at Boost.Asio library an it's examples. There are two HTTP server examples.

Second, if you need a rough plan on what to do here it is:

  1. Create socket, bind() it on needed address (0.0.0.0 for example), run listen() on it and get ready to accept() connections.
  2. After accepting new connection, you can recv() data from it, which would be plain text accorfing to HTTP protocol.
  3. After determining what client wants you should make up buffer and send() it back.

Exact function names and overall details are dependent on your programming language.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.