mutithread_web_server

mutithread_web_server - #include / for printf()...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <stdio.h> // for printf() #include <stdlib.h> // for exit() #include <string.h> // for strcpy(),strerror() and strlen() #include <fcntl.h> // for file i/o constants #include <sys/stat.h> // for file i/o constants #include <errno.h> /* FOR BSD UNIX/LINUX ---------------------------------------------------- */ #include <sys/types.h> // #include <netinet/in.h> // #include <sys/socket.h> // for socket system calls #include <arpa/inet.h> // for socket system calls (bind) #include <sched.h> #include <pthread.h> /* P-thread implementation */ #include <signal.h> /* for signal */ #include <semaphore.h> /* for p-thread semaphores */ /* ------------------------------------------------------------------------ */ //----- HTTP response messages ---------------------------------------------- #define OK_IMAGE "HTTP/1.0 200 OK\nContent-Type:image/gif\n\n" #define OK_TEXT "HTTP/1.0 200 OK\nContent-Type:text/html\n\n" #define NOTOK_404 "HTTP/1.0 404 Not Found\nContent-Type:text/html\n\n" #define MESS_404 "<html><body><h1>FILE NOT FOUND</h1></body></html>" //----- Defines ------------------------------------------------------------- #define BUF_SIZE 1024 // buffer size in bytes #define PORT_NUM 6110 // Port number for a Web server (TCP 5080) #define PEND_CONNECTIONS 100 // pending connections to hold #define TRUE 1 #define FALSE 0 #define NTHREADS 5 /* Number of child threads */ #define NUM_LOOPS 10 /* Number of local loops */ #define SCHED_INTVL 5 /* thread scheduling interval */
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course CS 7103 taught by Professor Kannan during the Fall '11 term at LSU.

Page1 / 3

mutithread_web_server - #include / for printf()...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online