Network Programming Elective)
Network Programming Elective)
PART- A 1 a How do you discover network topology? Explain with examples b With a neat diagram explain the TCP connection establishment and termination c A connection is established between a host on an Ethernet, whose TCP advertises an MSS of 1460 and a host on a token ring, whose TCP advertises an MSS of 4096. Neither host implements pata MTU discovery. Watching the packets, we never see more than 1460 bytes of data in either direction. Why? 2 a With a neat diagram, compare the different socket address structures b Why must value-result arguments such as the length of a socket address structure be passed by reference? Explain with an example c What is byte ordering? Explain the following function (i) htons ( ) (ii) htonl ( ) (iii) ntohs ( ) (iv) ntohl ( ) 3 a Explain the socket functions for elementary TCP client/server with a neat diagram b In a concurrent server, assume the child runs first after the call to fork. The child then completes the service of the client before the call to fork returns to the parent. What happens in the two calls to close ( ) functioin in the following code pid_ t pid; 9nt listenfd, connfd ; listenfd = socket ( . . .) ; bind (listenfd. . . .) ; listen (listenfd, LISTEN); for ( ; ; ) { connfd= accept (listenfd, . . .) ; if ( ( pid=fork ( ) ) = = 0 ) { close (listenfd); doit (connfd) ; close (connfd); exit (0) : } close (connfd) ; // parent } c Write a C program to implement the TCP echo server
06 08 06
06 06 08
06
08
4 a What is fcntl function? Explain the features provided by fcntl with respect to network programming b Assume two TCP clients start at about the same time. Both set the SO__REUSEADDR socket option and then call bind with the same local IP address and the same local port say ( 1500).But one client connects to 19.69.10.2 port 7000 and the second connects to 198.69.10.2 ( same peer IP address) but port 8000. Describe the race condition that occurs c There are two applications, one using TCP and other using UDP9 4096 bytes are in the receive buffer for the TCP socket and 2048 byte datagrams are in the receive buffer for the UDP socket. The TCP application calls read with a third argument of 4096 and the UDP application calls recv from with a third argument of 4096. Is there any
06 08
06