BIT3105 -NETWORK PROGRAMMING  BCT2203-CLIENT SERVER COMPUTING .

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY
BIT3105 -NETWORK PROGRAMMING & BCT2203-CLIENT SERVER
COMPUTING
FULL TIME/PART TIME/DISTANCE LEARNING
DATE: AUGUST 2018 TIME: 2 HOURS
INSTRUCTIONS
 Answer Question ONE (Compulsory) and Any Other Two Questions.

Question 1 (30 Marks) – Compulsory
(a) Differentiate between:
i. ARP and RARP [2 Marks]
ii. RMI and RPC [2 Marks]
iii. wait() and wait_pid() [2 Marks]
iv. TCP and UDP [2 Marks]
(b) What is the purpose of a zombie state? [2 Marks]
(c) Give the generic structure of a socket address and briefly explain the parts of the structure.
[6 Marks]
(d) Distinguish between an “Ethernet frame” and an “IP datagram” [4 Marks]
(e) Study the program given below and answer the questions that follow.
1. #include <stdio.h>
2. #include <sys/types.h>
3. #include <sys/socket.h>
4. #include <netinet/in.h>
5. #include <netdb.h>
6. void error(char *msg)
7. {
2
8. perror(msg);
9. exit(0);
10.}
11.int main(int argc, char *argv[])
12.{
13.int sockfd, portno, n;
14.struct sockaddr_in serv_addr;
15.struct hostent *server;
16.char buffer[256];
17.if (argc < 3) {
18.fprintf(stderr,”usage %s hostname port\n”, argv[0]);
19.exit(0);
20.}
21.portno = atoi(argv[2]);
22.sockfd = socket(AF_INET, SOCK_STREAM, 0);
23.if (sockfd < 0)
24.error(“ERROR opening socket”);
25.server = gethostbyname(argv[1]);
26.if (server == NULL) {
27.fprintf(stderr,”ERROR, no such host\n”);
28.exit(0);
29.}
30.bzero((char *) &serv_addr, sizeof(serv_addr));
31.serv_addr.sin_family = AF_INET;
32.bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server-
>h_length);
33.serv_addr.sin_port = htons(portno);
34.if (connect(sockfd,&serv_addr,sizeof(serv_addr)) < 0)
35.error(“ERROR connecting”);
36.printf(“Please enter the message: “);
37.bzero(buffer,256);
38.fgets(buffer,255,stdin);
39.n = write(sockfd,buffer,strlen(buffer));
40.if (n < 0)
41.error(“ERROR writing to socket”);
42.bzero(buffer,256);
43.n = read(sockfd,buffer,255);
44.if (n < 0)
45.error(“ERROR reading from socket”);
46.printf(“%s\n”,buffer);
47.return 0;
48.}
(i) Which line of code creates a socket? What is the name of the socket descriptor? [2 Marks]
(ii) What do the following lines of code do? [8 Marks]
Line number 25
Line number 34
Line number 39
Line number 46
Question Two – (Total Marks: 20)
(a) Define the following terms as used in client/server systems:
i. Communication architecture [1 Mark]
ii. Business Logic [1 Mark]
iii. Server [1 Mark]
(b) Briefly discuss “Distributability” and “Portability” as attributes of a middleware.
[4 Marks]
(c) Different between a “Process” and a “Thread”. [2 Marks]
(d) Explain the function of TCP TIME_WAIT primitive. [3 Marks]
(e) It has been said that flow control and congestion control are equivalent. Is this true for the
Internet’s connection-oriented service? Are the objectives of flow control and congestion
control the same? [4 Marks]
(f) List and explain the two (2) mechanisms that a middleware uses to facilitate communication
between client/server application. [4 Marks]
Question Three – (Total Marks: 20)
(a) Using a well labeled diagram, illustrate the communication between a client and server from
the time a socket is created to when the connection is terminated. [7 Marks]
(b) Why does an association have five (5) entries instead of six (6)? [2 Marks]
(c) Once a TCP connection has been terminated there is a possibility of some unfinished business.
How does TCP take care of these businesses? [3 Marks]
(d) Three (3) things happen when a server accepts a connection request from a client. List and
explain them. [6 Marks]
(e) There are two main address domains/protocol families: Internet domain and Unix domain
protocol families. What is the main difference between them? [2 Marks]
Question Four – (Total Marks: 20)
(a) (i) What does the bind() system call do? [1 Mark]
(ii) Briefly describe the parameters that the bind() system call takes. [3 Marks]
(b) The banking industry has fully adopted and implemented client/server systems. With
appropriate examples, at least two (2), discuss these implementations. [8 Marks]
(c) What are Byte Ordering Functions? [2 Marks]
(d) Processes running in a networked environment can communicate in two ways either
through Remote Procedure Calls (RPC) or Message Passing. Distinguish between these two.
[4 Marks]
(e) In a sequential server application, what prevents the server from dying once it has
served a client? [2 Marks]
Question Five – (Total Marks: 20)
(a) With an aid of a simple program, explain the fork() system call. [7 Marks]
(b) What does the Child inherit when you use the fork() system call. [6 Marks]
(c) List two error messages that one can receive when using the fork () system call? [2 Marks]
(d) Explain three ways for process to terminate normally after you have used the Fork() system
call [3 Marks]
(e) What do you understand by the term Automatic port number assignment when used in
Network Programming? [2 Marks]

(Visited 102 times, 1 visits today)
Share this:

Written by