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
If a UDP datagram is sent from host A, port P to host B, port Q, but at host B there is no process listening to port Q, then B is to send back an ICMP Port Unreachable message to A. Like all ICMP messages, this is addressed to A as a whole, not to port P on A. (a)  Give an example of when an application might want to receive such ICMP messages. (b)  Find out what an application has to do, on the operating system of your choice, to receive such messages. (c)  Why might it not be a good idea to send such messages directly back to the originating port P on A?
Discuss how business intelligence and data visualization work together to help decision-makers and data users. Provide 2 specific use cases.
This week we will be building a regression model conceptually for our discussion assignment. Consider your current workplace (or previous/future workplace if not currently working) and answer the following set of questions. Expand where needed to help others understand your thinking:  What is the most important factor (variable) that needs to be predicted accurately at work? Why? Justify its selection as your dependent variable.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781305971776
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Text book image
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L
Text book image
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781285867168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning