654 chapter 12 network programming 1 2 3 4 5 6 7 8 9

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: the child process is busy servicing the client. data transfers client 1 clientfd child 1 connfd(4) listenfd(3) server client 2 clientfd Figure 12.31: Server forks a child process to service the client. Now suppose that after the parent creates the child for client 1, it accepts a new connection request from client 2 and returns a new connected descriptor (say 5), as shown in Figure 12.32. data transfers client 1 clientfd child 1 connfd(4) listenfd(3) server connection request connfd(5) client 2 clientfd Figure 12.32: Server accepts another connection request. The parent forks another child, which begins servicing its client using connected descriptor 5, as shown in Figure 12.33. At this point, the parent is waiting for the next connection request and the two children are servicing their respective clients. Figure 12.34 shows the code for a concurrent echo server based on processes. The echo function in line 25 is defined in Figure 12.29. There are several points to make about this server...
View Full Document

Ask a homework question - tutors are online