This preview shows page 1. Sign up to view the full content.
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 deﬁned in Figure 12.29. There are several points to make about this server...
View Full Document
- Spring '10
- The American