You are on page 1of 2

Birla Institute of Technology & Science, Pilani Work-Integrated Learning Programmes Division Second Semester 2009-2010 Comprehensive Examination

(EC-2 Regular) Course No. Course Title Nature of Exam Weightage Duration Date of Exam Note:
1. 2.

: IS ZC462 : NETWORK PROGRAMMING : Open Book : 60% : 3 Hours : 03/04/2010 (FN)

No. of Pages =2 No. of Questions = 6

Please follow all the Instructions to Candidates given on the cover page of the answer book. All parts of a question should be answered consecutively. Each answer should start from a fresh page.

Q.1 (a). Q.1 (b).

Can a computer have two DNS names that fall in different top-level domains? If so, give a plausible example. If not, explain why not? Write the basic necessary requirements for multicasting on a WAN? For the given IP Multicast address 232.200.224.172; write the mapped Ethernet multicast address? [4 + 5 = 9] What happens to a child if the parent terminates before the child? How the arisen problem if any is handled? What happens if a Unix Domain Server does not unlink its well known path name when it terminates, and a client tries to connect to the server sometimes after the Server terminates? [4 + 4 = 8]

Q.2 (a). Q.2 (b).

Q.3. Consider the following partial client function code in which child copies lines from the server to standard output and the parent copies lines from standard input to the server as shown below : stri_cli( FILE *fp,int sockfd) { pid_t pid; char sendline[MAXLINE] ,recvline[MAXLINE]; if((pid=fork())==0) { while(Readline(sockfd,recvline,MAXLINE)>0) fputs(recvline,stdout); kill(getppid( ) ,SIGTERM ); exit(0); } while(fgets(sendline,MAX,fp)!=NULL) writen(sockfd,sendline,strlen(sendline)); close (sockfd); pause(); return; (a). (b). (c). } What benefits we have in writing the client side code as per the logic shown above? Identify any problems/flaws if any in the above code? Justify? Give the better solution to solve the above problem? Give only the steps or changes you need to do? [3 + 3 + 3 = 9] Page 1 of 2

IS ZC462 (EC-2 Regular) Second Semester 2009-2010

IS ZC462 (EC-2 Regular)

Second Semester 2009-2010

Page 2

Q.4. A process on host A has been assigned port 5462, and a process on host B has been assigned port 9876. Is it possible for there to be two or more TCP connections between these two ports at the same time? Explain. [4] Q.5. Consider the sequence of commands to be executed as show in the figure below. The output of ls l is given to two different processes running grep ^d and grep ^-. They pass their output to two different processes executing wc l command. Suppose you are required to implement the following sequence of commands producing two different outputs i.e number of sub directories and number of files in the current directory. Write a complete program that executes each command in different processes and direct the data flow using appropriate IPC mechanisms (only pipe/FIFO). The program finally prints two outputs. [10]

Q.6. Write a client server program using stream oriented Unix Domain Protocol Family such that they perform the following task: The client will pass the server a string consisting of a sequence of characters taken from stdin. If the server sends a "Sorry" response to the client it will immediately exit else display the received result. The server will respond with "Sorry, cannot compute, if the received string contains anything but not numbers. If the string contains all numbers, the individual digits will be added together and returned as a string. If the server receives a string of numbers, it will a) add the digits together b) send the value back to the client, and c) will not exit unless the response is a single digit. This process will be repeated until there is only one digit remaining and send it to client. Your client program should also pass its credential and server will display the received senders credentials. [20] ********

IS ZC462 (EC-2 Regular) Second Semester 2009-2010

Page 2 of 2

You might also like