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
What are the major threats of using the internet? How do you use it? How do children use it? How canwe secure it? Provide four references with your answer. Two of the refernces can be from an article and the other two from websites.
Assume that a string of name & surname is saved in S. The alphabetical characters in S can be in lowercase and/or uppercase letters. Name and surname are assumed to be separated by a space character and the string ends with a full stop "." character. Write an assembly language program that will copy the name to NAME in lowercase and the surname to SNAME in uppercase letters. Assume that name and/or surname cannot exceed 20 characters. The program should be general and work with every possible string with name & surname. However, you can consider the data segment definition given below in your program. .DATA S DB 'Mahmoud Obaid." NAME DB 20 DUP(?) SNAME DB 20 DUP(?) Hint: Uppercase characters are ordered between 'A' (41H) and 'Z' (5AH) and lowercase characters are ordered between 'a' (61H) and 'z' (7AH) in the in the ASCII Code table. For lowercase letters, bit 5 (d5) of the ASCII code is 1 where for uppercase letters it is 0. For example, Letter 'h' Binary ASCII 01101000 68H 'H'…
What did you find most interesting or surprising about the scientist Lavoiser?
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