Pthreadcancelpthreadt tid void pthreaddetachpthreadt

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 44: CGI program that sums two integers. 654 CHAPTER 12. NETWORK PROGRAMMING 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 unix> telnet 8000 Client: open connection Trying Connected to Escape character is ’ˆ]’. GET /cgi-bin/adder?15000&213 HTTP/1.0 Client: request line HTTP/1.0 200 OK Server: Tiny Web Server Content-length: 115 Content-type: text/html Client: empty line terminates headers Server: response line Server: identify server Adder: expect 115 bytes in response body Adder: expect HTML in response body Adder: empty line terminates headers Welcome to THE Internet addition portal. Adder: first HTML line <p>The answer is: 15000 + 213 = 15213 Adder: second HTML line in response body <p>Thanks for visiting! Adder: third HTML line in response body Connection closed by foreign host. Server: closes connection unix> Client: closes connection and terminates Figure 12.45: An HTTP transaction that serves dynamic HTML content. The T INY main Routine Figure 12.46 shows T INY’s main routine. T INY is an iterative server that listens for connection requests on the port that is passed in the command line. After opening a listening socket (line 28) by calling the open listenfd function from Figure 12.46, T INY executes the typical infinite server loop, repeatedly accepting a connection request (line 31) and performing a transaction (line 32). The doit Function The doit function in Figur...
View Full Document

Ask a homework question - tutors are online