Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 12, Problem 12.36HW

Explanation of Solution

Implementation of a concurrent prethreaded version of the TINY web server:

For code “echoservers.c” and “echoservers.h” file:

Use section 12.2.1 code.

For code “tiny.c” and “tiny.h”:

Use section 11.6 code.

sample.html:

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>Home</title>

</head>

<body>

  Tiny server Example

</body>

</html>

main.c:

#include <stdio.h>

#include "csapp.h"

#include "echoservers.h"

//Main function

int main(int argc, char **argv)

{

  //Declare variable

  int listenfd, connfd;

  socklen_t clientlen;

  struct sockaddr_storage clientaddr;

  static pool pool;

/* If the arguments does not contain two arguments, then display the below statement */

  if (argc != 2)

  {

    fprintf(stderr, "usage: %s <port>\n", argv[0]);

    fprintf(stderr, "use default port 5000\n");

    listenfd = Open_listenfd("5000");

  }

  //Otherwise call Open_listenfd function

  else

  {

    listenfd = Open_listenfd(argv[1]);

  }

  //Then call the init_pool function

  init_pool(listenfd, &pool);

  //Check condition

  while (1)

  {

/* Wait for listening or connected descriptor(s) to convert ready */

    pool.ready_set = pool.read_set;

pool.nready = Select(pool.maxfd+1, &pool...

Blurred answer
Students have asked these similar questions
Write a simple multithreaded web server in C#. Regardless of the page requested, the server should respond with an HTML page displaying just the words "PTUK Final Exam C#-Socket- Programming"
Q2.Recently QUIC protocol is suggested. a. Elaborate on the advantages of QUIC through an example scenario. b. The standard protocols, like TCP, UDP and HTTP, are implemented in various languages. For example, Java language has ServerSocket() class for TCP server. Does the QUIC protocol is supported in any language? I mean its library is available. If yes, please explain its working. And run a simple QUIC client program, even if this program is available over the Internet. c. List the servers supporting QUIC protocol, if they exist.
Computer Science C programming Develop a proxy HTTP server that can accept HTTP requests from clients and convert them to HTTPS request to the web server. The HTTP request can be filtered based on an access control list. The requests can be generated by any web client, such as the curl command or a web browser. the proxy converts plain text HTTP requests from a client to HTTPS requests and then returns the responses to the client. Main objective is to create a proxy HTTP server that converts cleartext HTTP requests from clients to HTTPS requests to servers and vice versa for the responsesresponses.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education