Вы находитесь на странице: 1из 2

Birla Institute of Technology & Science, Pilani

Distance Learning Programmes Division


First Semester 2008-2009

Comprehensive Examination (EC-2 Regular)

Course No. : IS ZC462
Course Title : NETWORK PROGRAMMING
Nature of Exam : Open Book
Weightage : 60%
Duration : 3 Hours
Date of Exam : 27/09/2008 (FN)
Note:
1. Please follow all the Instructions to Candidates given on the cover page of the answer book.
2. All parts of a question should be answered consecutively. Each answer should start from a fresh page.
3. Leave about one inch margin space on all four sides of the answersheet.
4. Mobile phones and computers of any kind should not be used inside the examination hall.

Q.1 (a). Consider the following processes running on the same host:
P2 is parent of C2
C3 is child of C2
C1 is child of P1
What means of IPC can be used for C3 to communicate with P2 and P2 to communicate with
P1 from Pipe, Unix domain protocols socket, named Pipe, and sockets?

Q.1 (b). What is output of the following?
main()
{ int z=5;
if (fork()) {
printf("\t ISZC462 ");
z=10;
}
else
printf("Net Prog");
printf(" PID =%d Z=%d \n",getpid(), z);
exit(0);
}

Is the above code leads to zombies state? If your answer is yes explain how and re-write
the above code to get rid of these states using signal? [3 + 5 = 8]

Q.2 (a). Pipes support half duplex communication. But if we want full-duplex communications
we should use two pipes between two processes. Is such situation can leads to
deadlock? Write two scenarios that could leads to deadlock in such situations?

Q.2 (b). Why does the server parent need to close the connected socket returns from accept in
a concurrent TCP server? What may happen if it does not do so?

Q.2 (c). Name the protocols used in HTTP, TELNET and DNS application? How many
connections used in FTP protocols, name them. [4 + 3 + 3 = 10]

No. of Pages = 2
No. of Questions = 6
IS ZC462 (EC-2 REGULAR) FIRST SEMESTER 2008-2009 PAGE 2


Q.3 (a). Consider a TCP echo client which blocks on fgets which read input from standard
input. If now the corresponding server process crashes, what will client TCP kernel
receive? Can the client process receive that? Why or why not? How you solve the
above problem?

Q.3 (b). What will happens when we don't call of bind()and listen() in a normal echo server ?

Q.3 (c). What are the purposes of the three file descriptors on which the syslogd daemon
listens and does I/O multiplexing? [3 + 3 + 3 = 9]

Q.4 (a). Explain how and when a DNS request is solved when a user tries to surf to the site
www.bits-pilani.ac.in .Assume the user machine uses a local name server and sits on
another network other than www.bits-pilani.ac.in.

Q.4 (b). Reason out why did you need the qualifier that the socket had to be non-blocking in
order for a write operation to return a positive value while describing the conditions
for which select return writable?

Q.4 (c). 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 he server sometimes after the server
terminates? [5 + 3 + 3 = 11]

Q.5 (a). Using the appropriate system calls, write a program fragment which creates a new
process which will execute the program ls >out. You may take executable ls and
file out as fixed parameters for your program fragment. Your program should
handle all kind of suitable possible errors with appropriate diagnostic message.

Q.5 (b). To increase the speed, we normally go for nonblocking I/O. The same can be done by
paralleling the input and output operations with the help of a fork. Write an echo
client using fork where the parent reads the input (from stdin) and writes it to the
socket and child reads the reply (servers) from the socket and displays it at the stdout.
The echo server should be a daemon process. [4 + 8 = 12]

Q.6 Develop a multicast terminal chat program that takes as optional arguments a multicast
host address and optionally a port number. The program should print the host address and
port that it is using. After bind and setsockopt () the program should send a message like:
SIGNING IN using getuid() and gethostname(). The program should create a child
process to continuously read from the socket and write to the terminal, prefacing each
received line with the name, hostname of the sender. The parent process should
continuously read a line from stdin and send it out the socket until the user types ctrl-d.
Then the parent process should send a sign-off message as SIGNING OUT and kill the
child and exit. [10]

*******

Вам также может понравиться