0% found this document useful (0 votes)
3 views

Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Internal Assignment

Unix Network Programming


2024-25

1. What is the purpose of listen socket call? Explain the significance of backlog parameter.
2. Why must value-result arguments such as the length of a socket address structure be
passed by reference?
3. Write a procedure to implement a TCP client working on the IP address 192.168.11.0
and a wild card port number. Client connects to server with address 202.13.5.8 and port
number 2025. Client sends a message ‘‘Hello” and terminates.
4. Why do both the readn and writen functions copy the void* pointer into a char* pointer?
5. Which end of a connection goes through the TIME WAIT state? What is the duration
of this state? What is the reason for having this state?
6. Write implementation of a TCP concurrent server with the following specifications :
Server binds on 192.168.23.18 and port number 5023. When a client connects, server
prints the client’s address and sends a message ‘‘connection OK” to client. Server
counts the number of the clients connected and prints that number whenever a client
connects.
7. Explain the prototype of inet_addr system call. Why is it deprecated?
8. What is the default behavior of close() socket call? How can it be changed in a socket
application? Does it always initiate the 4 way TCP connection termination?
9. Represent the data 0 x 1020 in big endian and little endian format. Which byte ordering
is used in network byte order and host byte order?
10. What are the different errors returned from the connect() socket call?
11. What is a socket pair? Write the importance of socket pair in network communication.
Explain it in the context of a concurrent server with the help of a diagram.
12. Write a signal handler for SIGPIPE that just prints a message and returns. Establish this
signal handler before calling connect. Change the server’s port number to 13, the
daytime server. When the connection is established, sleep for two seconds, write a few
bytes to the socket, sleep for another two seconds, and write a few more bytes to the
socket. Run the program. What happens?
13. How can we change the behavior of close socket call by using SO_LINGER option?
14. Explain the purpose of SO_REUSEADDR and SO_REUSEPORT.

You might also like