0% found this document useful (0 votes)
113 views2 pages

Network Programming Elective)

This document appears to be exam questions for a Network Programming course. It contains 4 questions with multiple parts each about topics including: - Network topology discovery methods - TCP connection establishment and termination - Byte ordering functions like htons() - Socket programming functions for a TCP client/server - The fork() function and its interaction with sockets - The fcntl() function and its uses for network programming - Potential race conditions when binding sockets - Differences between reading from TCP and UDP sockets

Uploaded by

Atanu Ghosh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views2 pages

Network Programming Elective)

This document appears to be exam questions for a Network Programming course. It contains 4 questions with multiple parts each about topics including: - Network topology discovery methods - TCP connection establishment and termination - Byte ordering functions like htons() - Socket programming functions for a TCP client/server - The fork() function and its interaction with sockets - The fcntl() function and its uses for network programming - Potential race conditions when binding sockets - Differences between reading from TCP and UDP sockets

Uploaded by

Atanu Ghosh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

07CS661

USN R. V. COLLEGE OF ENGINEERING


Autonomous Institution under VTU VI Semester B. E. Examinations May/June-10

Computer Science and Engineering

NETWORK PROGRAMMING (ELECTIVE)


Time: 03 Hours Maximum Marks: 100 Instructions to candidates: Answer any FIVE full choosing atleast 2 out of 4 questions from Part-A and Part-B

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

You might also like