IT1352-NETWORK PROGRAMING AND MANAGEMENT Two Marks Questions With Answers 2014

Anna University, Chennai




QUESTION BANK - Part A(2 marks)


1.Compare TCP and UDP.



1.It is a connection oriented protocol

It is a connection less protocol

2.TCP is reliable byte stream protocol

UDP is simple unreliable datagram protocol

2. What is the use of ARP and RARP?

ARP (Address resolution protocol):it is used to find the physical address if the ip address is known.

RARP (Reverse address resolution protocol): it is used to find the ip address if the physical address is known.

3. What is IANA?

IANA (Internet assigned number authority) divides the port address.

4. What is mean by well known port?

In well known port, port no and the port address are 16 bits.the range is from 0 to is assigned and controlled by IANA.It is used in server process.

5. Compare physical ,logical and port address?

Physical address

Logical address

Port address

1.It belongs to datalink layer

It belongs to network layer

It belongs to transport layer

2.The size and format depends on network

This is a 32 bit address and is uniquely identified between the node and internet

This is a 16 bit address

6.write a program to print its own process ID?


#include<conio.h> Intmain(void)


Pid_t pid; Pid=getpid( );

Printf (“my pid=%d”,pid);


7.write a program to print the process ID of parent and child.


#include<conio.h> Int main (void)


Pid_t pid; Pid=fork ( ) If (pid==0)

Printf (“child pid-%d\n”,pid); Pid_getppid();

Printf (my parent pid=%\n”, pid); Return ();


8. Define socket. give structure of socket

In client server model two application program one running on local system (client) and another running on remote system (server) need to communicate with one another. The communication structure that we need in socket programming is socket.

9. Define the types of sockets?

1. Stream socket (SOCK STREAM)

2. Datagram socket (SOCK_DGRAM)

3.Raw socket(SOCK_RAW)

10.Explain The Fields Present In Sockaddr_In Structure?

Struct sockaddr_in


Uint8_t sin_len; /*length of the socket*/ Sa_family_t sin_family; /*AF_INET*/

In_port_t sin_port; /*16 bit port addr*/ Struct in_ addr sin_addr; /*32 ipv4 ADDR*/ Char sin_zero[8]; /*UNUSED FIELD*/


Struct int_addr


In_addr_t s_addr; /*32 bit IPV4 addr*/

11.Specify The Fields In Sockaddr_In6.

Struct int addr


Unit8_t sa_addr[16]; /*128 bit IPV6 addr*/


#Define SIN6-LEN

struct sockaddr_in6


Uint8_t sin6_len; /*length of the socket*/ Sa_family_t sin6_family; /*AF_INET6*/ In_port_t sin6_port; /*16 bit port addr*/ Uint32_t sin6_flowint /*flow control*/

Struct in6_addr sin6_addr: /*32 IPV4 addr*/

12. What are the data types used in client server program?

The data types used in client server program are,

Data types




Uint8_t Int16_t Uint16_t Int32_t Uint32_t Sa_family_t Socklen_t In_addr_t In_port_t

Signed 8 bit integer

Unsigned 8 bit integer Signed 16 bit integer unSigned 16 bit integer signed 32 bit integer unsigned 32 bit integer

address family of socket addr


length of socket addr atructure

IPV4 address

TCP or UDP port,normally uint 16_t











13. What is network byte order?

Network byte order chooses its own byte order by the protocols may be either LEBO or


14.What is the purpose of inet_aton function?

The purpose of inet_aton function is to convert the dotted decimal format to 32 bit binary format in network byte order.


Int inet_aton(const char * strptr,struct in_addr *addrptr);

15. What are the function designed for byte order transformation?

They are,

1.Htons(host to network short)

Uint16_t htons(uint16_t host 16 bitvalue)

2.ntohs(network to host short)

Uint16_t ntohs(uint16_t net 16 bit value)

3.htonl(host to network long)

Uint32_t htonl(uint32_t host 32 bitvalue)

4.ntohl(network to host long)

Uint32_t ntohl(uint32_t net32 bitvalue)

16. How a socket is uniquely identified?

The socket function returns a small non negative integer value,similar to a file we call this to be socket descriptor.


Int socket(int family,int type,int protocol);

17. What is the purpose of bind and connect?

BIND:Function is used to assign the local socket address to already created socket.


Int bind(int sockfd,const struct sockaddr*myaddr,socklen_t addrlen);

CONNECT:Functionn is used by TCP client to establish active connection with TCP server.


Int connect(int sockfd,const struct sockaddr*serveraddr,socklen_t addrlen);

18.What is the need for listen and accept system call?

LISTEN:Function enforce operating system that the server is ready to accept the connection with TCP server.

Syntax: int listen(int sockfd,int backlog);

ACCEPT:Function is called by tcp server to return the next completed connection from of the com[pleted connection queue.

Syntax: int accept(int sockfd,struct sockaddr cliaddr,sockaddrlen_t addrlen);

19. Specify address conversation functions?

There are 5 conversation functions,they are,

1. inet_aton int inet_aton(const char*strptr,struct in_addr*addrptr);

2.Inet_ntoa -char *inet ntoa(struct in_addr inaddr);

3.inet_addr -in-addr_t inet_addr(const char *str ptr);

4.inet_pton -int inet_pton(int family,const char *strptr,void*addrptr);

5.inet_ntop -const char *inet_ntop(int family,const void *addrptr,char *strptr,size tlen);

20. Explain the operation of fork ( ) system call?

Fork( ) causes the process to split into two identical process one retains the original process identification number(PID) and is called parent,the other called child gets a new PID.

21. What are the functions used for byte manipulation operations?

Two groups of functions are for byte manipulation

B (byte)

Ø Bzero

Ø Bcopy

Ø Bcmp

Mem (memory)

Ø Memset

Ø Memcopy

Ø Memcmp

22. What is socket abstraction?

Socket is an abstraction through which an application may send and receive data in the same way as an open file allows an application to read and write data to stable storage.

23. Compare various socket address structures?






16 bitport |32 bit ipv4 addr


16 bitport|32 bit flow label 128 bit IVV6 addr


pathname(upto 104 bytes)


Interface name and link layer addr.

24. Write short notes on sendto and recvfrom system call?

SENDTO: function is used by a UDP process to send a message to another process running on remote


RECVFROM:function is used by a UDP process to send a reply to the sender.

25. Differentiate iterative and concurrent server?

Iterative server runs only one client at a time.

Concurrent server runs two or more clients at the same time.


1.Define posix.

Posix is a group of standard developed by IEEE. UNIX standardization is done in posix and open group posix is adopted as ISO & IEC.

2.Define signal.

Signal is a notification process that an event has occur. It is also called as software interrupt. The signal can occur asynchronously. The process won’t know the time exactly when the signal has occur.

3.Mention the ways to send signal.

Two ways are:

a.Process to process b.Kernel to process

4. Define Disposition.

Disposition is action associated with signal. We set the disposition of the signal. We set the disposition of the signal by calling the sigaction function.

5.What are the three choices for disposition?

a. We can provide a function that is called whenever a specific signal occurs. This action is called catching the signal.

b. Ignore the signal by setting its disposition to SIG_IGN


c. We can set the default disposition for a signal by setting its disposition to

6.Specify general format for signal function.

A pointer to a signal handling function is the second argument to the function, as well as the return value from the function.

Sigfunc *signal (int signo,sigfunc *func);

Sidno->signal name or signal no. Func->signal handling function

7. What is handling SIGCHILD signal?

When ever a process finishes execution its parent will be modified by the kernel by a SIGCHILD. The signal is generated automatically. The parent process will be interrupted. The parent process may choose either ignore, go to system default or catch and handle the signal.

8. What is slow system call?


Slow system call is a system call that can block for an undetermined period of

9. What is meant by wait?

The wait function is used by parent process to wait for the child process to complete or to terminate. The purpose of this wait is to avoid the child becoming the zombie state.

10. What is meant by waitpid?

Waitpid specify which process to wait for and whether not to block. Pid_t waitpid(pid_t pid,int *statloc, int options);

11. What is client termination?

When a client wants to terminate the connection it send FIN segment to signal child. Whenever child is terminated the kernels automatically generate SIGCHILD to inform to the parent that child is terminated.

12. Specify termination of server process?

* Crashing of server process

* Crashing of TCP server host

13. What is the crashing of TCP server host?

* Server host crashes it is unreachable

* Server host gets rebooted

* Server host is shutdown by system administrator

14. What are the boundary conditions for crashing of TCP server host?

* The client host crashes

* The client process crashes

* The server process crashes

* The server host crashes

* Network connectivity is lost

15. What is server shutdown?

Server is shutdown by the operator, when a UNIX system is shutdown, the iniit process normally sends the SIGTERM signal to all process waits some fixed amount of time. Then send SIGKILL signal to any process still running.

16. What is meant by polling ?

An application can lies in a loop calling recvfrom on a non blocking I/O model is called polling

17.What is IO multiplexing model?

I/O multiplexing model use any one of the function as select/poll

Application process call select system cal

Wait for the datagram socket to be readable

When select return the socket is readable, we can call recvfrom to copy the datagram into application buffer

recvfrom returns ok and then process the datagram.

18. Write any one advantage and disadvantage of I/O Multiplexing model?

Advt: Using select we can wait for more than one descriptor to be ready.

Disadvt: Instead of one system call we use two system calls select and recvfrom .

19. Write two types of I/O operation?

*Synchronous I/O

*Asynchronous I/O

20. What is meant by synchronous I/O with example?

It causes requesting process to be blocked until that I/O operation completes. Eg: blocking, Non – blocking, I/O multiplexing, signal driven multiplexing, signal driven I/O


21. What is meant by asynchronous I/O with example?

It doesn’t cause requesting process to be blocked. Eg: Asynchronous I/O model

22. What is select functions?

Select function monitor several sockets at the same time. This function return ready socket. Select function allows the process to instruct the kernel to wait for anyone of multiple events to occur and to wake up the process only when one or more of the events occurs or when a specific amount of time has passed.

23. Describe the general format of select function?


Int select(int maxfd1, fd_set *writeset, fd_set *exceptset, const struct timeval

clip_image001Return positive count of ready descriptors

0 if an timeout

-1 if error

24. Define wait forever.

Wait forever returns only when one of the specified descriptor is ready for I/O.

25. What is Donot wait at all?

Donot wait at all states that, return immediately after checking the descriptor. Time out point to timeval structure. Timeval value must be zero.

26.What are the conditions of the descriptor to become ready?

The conditions of the descriptor to become ready are If the socket is ready for reading. If the socket is ready for writing. Socket has an exception pending.

27. What are the steps involved for socket has exception handling?

Steps involved for socket has exception handling are:

There exist an out of band data for a socket. Socket is in the out of bank mark.

28. What is the difference between shutdown and close function?


With shutdown we can initiate TCP’s normal In this case of close function decrement the connection termination sequence regardless of reference count and closes the socket only if reference count. the count reaches 0.

Shutdown function tell the other end might Close function terminates both directions of have finish sending even though that end might data transfer – reading and writing.

Have send more data.

29. What is poll function?

Poll function test for events on multiple socket simultaneously. It should include the following header file.


int poll(struct pollfd *fdarray, unsigned long *nfds, int timeout); Returns count of ready descriptors

0 on timeout

-1 on error


1.what are the various way to get and set the options that affect a socket?

The getsockopt and setsockopt functions

The fontl function and

The ioctl function

2.give the general format for getsockopt?

int getsockopt(int sockfd,int level,int optname,void*optval,socklen_t*optlen)

sockfd->socket descriptor

level->integer that specifies the protocol specific code that interprets the option optname->integer that species the name of the option

optval->pointer to the variable into which the current value of the option is stored optlen->identifies the length of the option value

3.give the general format for setsockopt?

Intsockopt(int sockfd,int level,int optname,void*optval,socklen_t*optlen); Sockfd->socket descriptor

Level->integer that specifies the protocol specific cod that inmtreprets the option

Optname->integer that specifies the name of the option value

Optvalue->pointr to the variable into which th current value of the option is stored

Optlen->identifies the length of the option value

4.what are the following socket options inherited by a connect tcp socket from the listening socket?


5.What is meant by generic socket option?

They are protocol independent options and are handled by the protocol independent code within the kernel.

6.What is the purpose of SO_BROADCAST option?

It supports the datagram sockets and they enable or disable the ability of process to send broadcast messages.the application must set the option before sending the broadcast messages.

7.Give the characteristics of SO_DEBUG?

Only the tcp socket supports this.when this option is enabled,kernel key track of detailed information about all packets sent or received by tcp for the socket.

8.What is the use of SO_DONTROUTE?

It specifies that the outgoing packets are to bypass the normal routing mechanism of the underlying protocol.

9.Write notes on SO_ERROR socket option?

When an error occur on a socket the protocol module set a variable name SO_ERROR for that socket.that error is called as pending error.the process can obtain the value of SO_ERROR by using the socket error option.

10.Specify the function of SO_LINGER?

It specifies hoe the close() function operate for a connection oriented protocol.

11.What is the function of SO_OOBINLINE?

When this option is set,out of band data will be placed in the input sequence.

12. What is the function of SO_REUSEPORT?

This socket option allows duplicate binding but only if each socket that wants to bind the same address and port specify this socket option.

13.What is called IPV4 socket option?

These option are processed by IPV4 and have a level of IPPROTO_IP.

14.What do you meant by IP_IIDRINCL socket?

It is set for the raw IP using this,We can construct our own IP header for all the datagram being sent by the raw socket.

15.What are called ICMPV6 socket option?

This socket option are processed by ICMPV6 and has a level of ICMPV6.this sets the ICMPV6 filter structure. This structure specifies the 256 possible ICMP messages.they are passed to socket through a raw socket.

16.What are the options of IPV6?


17. What are the TCP options?

The tcp options are


18. What is the function of ICMP6_FILTER?

This option specifies which of the 256 possible ICMP6 message types are passed to the process on a raw socket.

19. Define nagle’s algorithm

If a given connection has out standing data then no small ackets will be sent on the connection until exsisting data is acknowleged.

20. Define DNS

Domain name system (DNS) maps between hostnames and IPaddresses.

21. What are called resources records?

Entries in DNS are called resources records.

22. What are the types of resources records?

They are 5 resources records .they are

# A

# AAAA (quad A)




23. Give the syntax of gethostname function

Gethostname function returns the current name of the host. General format: int gethostname(char*name , size_t namelen);

24. Specify the functions of gethostname function.

This function takes the host name and finds the coresspondind=g binary IP address from the hostent structure.

General format:

Struct hostent*gethostbyname(const char* hostname); Struct hostent

{ Char*h_name; Char*h_aliases; Int h_addrtype; Int h_length;



25. Define gethostaddr function

This function takes the binary IP address and find the host name corresponding to that address from the hostent structure.

General format:

Struct servent*getservbyname(const char*servname,const char*protoname); Struct servant

{ Char*h_name; char*h_aliases; int h_addrtype; int h_length;



26. Give the syntax for getservbyname function.

This function maps from the service name to the port number

General format:

Struct servant *getservbyname(const char * servname, const char * protoname); Struct servant

{ Char*s_name; Char*s_aliases; Int s_port; Char*s_proto;


27. Specify the functions of getservport system call

This function looks up a service name given its port number

General format:

Struct servant*getservname(int port,const char*protoname); Struct servant

{ Char*s_port;

Char*s_aliases; Int s_port; Char*s_proto;



1. What is dual stack?

Hosts running on both IPV4 protocol stack and IPV6 protocol stack is called dual stack.

2. What is the use of IPV6 address testing macros?

Twelve macros are defined to test an IPV6 address from certain properties. The first seven macros test

the basic type of IPV6 address.the final five macros test the scope of an IPV6 multicast address.

3. What is the need of IN6_IS_ADDR_V4MAPPED macro?

An IPV6 client cloud call the IN6_IS_ADDR_V4MAPPED macro to test the IPV6 address returned by the

Resolver .an IPV6 server could call this function to test the IPV6 address returned by accept or recvfrom.

4. What is IPV6_ADDRFORM socket option?

The IPV6_ADDRFORM socket option can change a socket from one type to another,subject to the

following restrictions.

(1) An IPV4 socket can always be changed to an IPV6 socket. Any IPV4 addr already associated with the socket are converted to IPV4 mapped IPV6 addresses.

(2) An IPV6 socket can be changed to an IPV6 socket only if any addresses already associated with the socket are converted to IPV6 mapped IPV6 addresses.

5. Why thread is called light weight processes?

Threads are sometimes called light weight processes since a thread is lighter in weight than a

Process.that is, thread reaction can be 10-100 times faster than process creation.

6. What is Pthread?

Posix threads are also called threads. These were standardized in 1995 as part of posix standard and

Most versions of UNIX support them. Pthread function being with Pthread_.

7. How is a thread created?

When a program is started by exec, a single thread is created,called the initial thread or main thread.

Additional threads are created by pthread create.

Syntax: int pthread_create(pthread_t*tid,const pthread_attr,void*(*func)(void*),void*arg);

8. How thread terminated?

One way for a thread to terminate is to call pthread_exit.

Syntax: void pthread exit(void*status) The other 2 ways are

(1) The function that started the thread can return.since this function must be declared as returning a void pointer that return value is the exit status of the thread.

(2) If the main function of the process returns or if any tread calls exits,the process terminates including threads.

9. What is a common technique for making the function thread safe?

The common technique for making the function thread safe is to define a new function whose name

Ends in_r. two of the function are thread safe only if the caller allocates space for the result

And passes that pointer as the argument to the function.

10. Name some of the thread safe function?

Asetime_r, ctime_r, getgrid_r, getgman_r, getlogin_r, getpwnam_r, getpwind_r, gmtime_r, localtime_r etc.

11. What is concurrent or parallel programming?

We call thread programming as concurrent programming since multiple threads can be running

concurrently, accessing same variables.

12. What are the functions that are used to lock and unlock the mutex?

Int pthread_mutex_lock(pthread_mutex_t*mptr);

Int pthread_mutex_unlock(pthread_mutex_t*mptr); Return 0 if ok

Positive exxx value on error.

13. Define protostructure?

Protostructure is used to handle the difference between IPV4 and IPV6. This structure contains two

Function pointers, two pointers to socket address structures, the size of the socket address structures

and the protocol value for ICMP. The global pointer pr will point to one of this structure that we will

Initialize for either IPV4 or IPV6.

14. Why is a mutex always associated with a condition available?

The condition is normally the value of some variable that is shared between the threads. The mutex is

required to allow this variable to be set and tested by the different threads. So mutex is always

Associated with a condition variable.

15. Establish signal handler for SIGALRM?

We establish our function sig alarm as the signal handler gor SIGALRM because each time we send a

UDP datagram we wait 3 seconds for an ICMP message before the next probe.

16. Differentiate IPV4 and IPV6 raw socket?

(1) All fields in the protocol handler send or receive on a raw IPV6 socket in network byte order.

(2) There is no similar to IPV4 socket option.

(3) Checksum on a IPV6 raw are handle differently.

17. Explain the concept of raw socket input?

(1) Raw socket input means the kernel pass the received IP datagram to raw socket. (2) received UDP packet and receive TCP packet are never passed to the raw socket.

(3) If a process wants to read IP datagram containing UDP or TCP packet the packet must be read at the data link layer.

(4)Most ICMP packets are passed to the new socket after the kernel has finished processing the ICMP packets.

18. Define latency?

The time it takes a parent to reach its destination is called latency.

19. What is the function of PING (packet internet grosper)?

The PING program checks the responsiveness between two host, it is used to check the connectivity.

20. What are the information returned by response of PING program?

(1) The IP address of where the echo reply came from

(2) No.of bytes of data send

(3) Round trip time (RTT) =sending time+receving time.

21. What is the function of trace route utility?

It will check responsiveness as well as trace the path a IP datagram follow from source to the destination.

22. What are the two sockets used in trace route program?

1. Raw socket on which we read all returned ICMP messages.

2. UDP socket on which we send the probe packets with the increasing TTLs.

23. Define mutex?

Mutex is a mechanism for implementing thread synchronization . it act like a lock protecting access to

a shared data resource.


1. Define SNMP.

SNMP refers to a set of standard for network management including a protocol, a database structure specification and a set of data objects.

2. Define network management system.

A network management system is a collection of tool for network monitoring and control that is integrated in following senses.

It is a single operator interface with a powerful but user friendly set of commands of performing most or all network management tasks.

A minimal amount of separate equipment is necessary.

3. Is SMNP uses TCP Justify.

No .SMNP depends on UDP, which is connectionless protocol. SMNP is itself connectionless.

4. Name the key elements of network management.

Management station Management agent Management information base Network Management protocol

5. Define management agent.

Management agent is the active element in the network management system.

6. Define management information base.

Collection of object is referred as MIB(management information base)

7. Specify the advantage of trap directed polling.

Saving of network capacity

Agent processing time

8. Define agent function.

Agent function gathers and records management information for one or more network elements and communicates the information to the monitor.

9. Define polling and events reporting.

Polling is a request response interaction between the manager and agent. The manager Can query any agent and request the values of various information elements, the agent Responds with information from its MIB.

With event responding, the initiative is with the agent and the manager is in the role of listener, waiting for incoming information, event reporting is useful for detecting problems.

10. Define proxy.

A proxy is an SNMP agent that maintains information on the behalf of one more non

SNMP devices.

11. Define structure of management information.

The structure of management information defines the general framework within which a

MIB can be defined and constructed.

12. What do you mean by application wide data types?

Application wide data types are relevant to a particular application.

13. What do you mean by object instance?

Object instance is a particular instance of an object type that has bound to a specific value.

14. What is the information stored in the top connectable?


Local IP address

Local port

Remote IP address

Remote port

15. What is the purpose of system group?

System group provides general information about the managed system.

16. What is the use of ipgroup?

Ipgroup provides information related to the implementation and execution experience of

IP on this system.

17. What are the operations supported by SNMP?

Get Set Trap

18. What is get request PDU?

The get request PDU is issued by an SNMP entity on behalf of a network management station application. The sending entity includes the following fields in PDU: PDU type, request_id, variable bindings. The receiving SNMP entity responds to a Get Request PDU with a Get Response PDU containing the same request_id.

19. What are the limitations of using SNMP?

SNMP may not suitable for the management or truly large networks because of the performance of polling.

SNMP is not suited for retrieving large volume of data, such as entire routing table.

SNMP traps are unacknowledged.

The basic SNMP standard provides only trivial authentication. SNMP does not directly support imperative commands.

SNMP does not support manager to manager communications.

20. What is trap PDU?

The trap PDU is issued by an SNMP entity on behalf of a network management agent application. It is used to provide the management station with an asynchronous notification of some significant event.

21. What are the types of Threats?

Interruption: An asset of a system is destroyed or becomes unavailable or unusable.

Interception: An authorized party gains access to an asset. This is threat to secrecy.

Modification: An authorized party not only gains access but also tampers with an asset. This is a threat to integrity.

Fabrication: An authorized party inserts counterfeit object into the system. This is a threat to integrity.

22. Name the network monitoring information.

Static: This is information that characterizes the current configuration and the element in the current configuration.

Dynamic: this information is related to events in the network. Statistical: This is information that may be derived from dynamic


23. What is MTBF?

Component failure is expressed by mean time between failure(MTBF). The availability, A

is based on MTBF and can be expressed as


Where MTTR is the mean time to repair the failure

24. What are the key capabilities of SNMP?

Get: Enables the management station to retrieve the value of objects at the agent

Set: Enables the management station to set the value of objects at the agent

Trap: Enables an agent to notify the management station of significant events.

25. State the features of SNMPV3.


Administrative feed back

26. What are the goals of RMON?

RMON specification is a definition of a MIB. The effect is to define standards network monitoring functions and interface for communicating between SNMP based management consoles and remote monitors.

27. What are the objectives of MIB?

Data base where manageable objects are defined.

The objects or objects used to represent a particular resource must be the same at each system.(Keeping data regarding active, passive or total open connections with any two of these data which must be uniform)

A common scheme for representation must be used to support interoperability.

28. What are the contents of MIB structures?

The internet naming hierarchy

Objects types Simple/Tabular objects Instance identification

29. What are the key elements for TCP/IP network management?

Management station Management agent Management information base Network Management protocol

No comments:

Post a Comment