Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Extensive_Network_Programming_Guide

The document is a comprehensive guide for a network programming exam, providing detailed answers to various questions related to client-server systems, TCP and UDP protocols, socket programming, and networking concepts. It covers topics such as the TCP three-way handshake, socket functions, remote procedure calls (RPC), and the role of firewalls. Additionally, it includes extensive exam questions for further study and understanding of network programming principles.

Uploaded by

joshuaonyango372
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)
4 views

Extensive_Network_Programming_Guide

The document is a comprehensive guide for a network programming exam, providing detailed answers to various questions related to client-server systems, TCP and UDP protocols, socket programming, and networking concepts. It covers topics such as the TCP three-way handshake, socket functions, remote procedure calls (RPC), and the role of firewalls. Additionally, it includes extensive exam questions for further study and understanding of network programming principles.

Uploaded by

joshuaonyango372
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/ 4

Comprehensive Network Programming Exam Guide

Full Answers to Exam Questions

1. **Explain what you understand by client-server systems.** [2 marks]


- The client-server model is a distributed computing architecture where clients request services,
and servers provide them. Clients initiate communication while servers wait for requests.
- Example: A web browser (client) requests a webpage from a web server.

2. **Role of Client and Server in Coursework Portal Access** [4 marks]


- Client: The student's device sends a request to access coursework marks.
- Server: The university's server processes the request and returns the marks.

3. **How is a TCP connection established? (Three-Way Handshake)** [2 marks]


- Step 1: SYN - Client sends a connection request to the server.
- Step 2: SYN-ACK - Server acknowledges and responds.
- Step 3: ACK - Client confirms, establishing the connection.

4. **Explain the significance of using a value-result argument.** [2 marks]


- Value-result arguments allow a function to return multiple values, ensuring flexibility.

5. **Why is the socket address size passed as a value-result argument in accept()?** [2 marks]
- This allows the kernel to update the actual address length of the connected client dynamically.

6. **What type of socket is created by the accept() function?** [2 marks]


- A new, fully connected TCP socket, which can send and receive data, distinct from the listening socket.

7. **Differentiate between TCP and UDP.** [4 marks]


- TCP: Connection-oriented, reliable, ensures data delivery.
- UDP: Connectionless, faster but unreliable.

8. **Big-endian vs Little-endian Byte Ordering (Diagram Required).** [3 marks]


- Big-endian: Stores the most significant byte first (used in networking).
- Little-endian: Stores the least significant byte first (used in x86 architectures).

9. **Purpose of ntohs(), htons(), ntohl(), and htonl() in Networking.** [4 marks]


- These functions convert between host byte order and network byte order for proper communication.
10. **Address Conversion Functions in IPv4 and IPv6.** [4 marks]
- inet_pton(): Converts presentation format (text) to binary form.
- inet_ntop(): Converts binary form to presentation format.

11. **Explain fork() and exec() in TCP Sockets.** [4 marks]


- fork(): Creates a new process (used for concurrent servers).
- exec(): Replaces a process image with a new program.

12. **What is RPC and why is it needed in networking?** [2 marks]


- Remote Procedure Call (RPC) allows execution of procedures on remote systems, simplifying distributed
applications.

13. **Explain the purpose of marshaling in RPC.** [2 marks]


- Marshaling converts function parameters into a format suitable for network transmission.

14. **Write the IPv4 Socket Address Structure.** [3 marks]


```c
struct sockaddr_in {
short sin_family; // Address family (AF_INET)
unsigned short sin_port; // Port number
struct in_addr sin_addr; // IP address
char sin_zero[8]; // Padding
};
```

15. **Explain the socket functions with code snippets.** [12 marks]
- **socket()** - Creates a socket.
```c
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
```
- **bind()** - Binds the socket to an address.
```c
bind(sockfd, (struct sockaddr*)&server_addr, sizeof(server_addr));
```
- **listen()** - Puts the server in listening mode.
```c
listen(sockfd, 5);
```
- **accept()** - Accepts incoming client connections.
```c
int client_sock = accept(sockfd, (struct sockaddr*)&client_addr, &client_len);
```

16. **Using netstat to Monitor TCP Connections.** [3 marks]


- Run:
```sh
netstat -an | grep 8080
```
- This displays active TCP connections.

17. **How do TCP and UDP handle data transmission differently?** [4 marks]
- TCP: Uses acknowledgments and retransmission to ensure reliability.
- UDP: Sends packets without waiting for acknowledgments.

18. **Explain the differences between active and passive sockets.** [3 marks]
- Active Socket: Initiates connections (e.g., client sockets).
- Passive Socket: Waits for incoming connections (e.g., server sockets).

19. **How does congestion control work in TCP?** [4 marks]


- TCP uses slow start, congestion avoidance, and retransmission timers to manage congestion.

20. **How do firewalls affect network programming?** [3 marks]


- Firewalls block unauthorized network traffic, requiring proper configurations for network applications.

50 Extensive Exam Questions & Answers

1. Define a client-server system and provide an example.


2. Explain the differences between TCP and UDP with examples.
3. How does the TCP three-way handshake work? Explain each step.
4. What are sockets and how are they used in network programming?
5. What is the structure of an IPv4 socket address?
6. Explain the role of middleware in distributed systems.
7. What is RPC and why is it used in networking?
8. How does a concurrent server handle multiple clients?
9. What is the purpose of the select() function in socket programming?
10. What are zombie processes and how do you prevent them?
11. Explain the role of DNS in networking.
12. What is a proxy server and how does it work?
13. How does a firewall impact network traffic?
14. What is the difference between unicast, multicast, and broadcast?
15. Explain the concept of load balancing in network applications.
16. How does SSL/TLS enhance network security?
17. What is NAT (Network Address Translation)?
18. Explain the difference between IPv4 and IPv6.
19. What is a socket descriptor?
20. How does TCP handle flow control?
21. Explain how connection termination occurs in TCP.
22. What is the significance of TIME_WAIT in TCP?
23. How do you monitor active TCP connections using Linux commands?
24. What are the key fields in a TCP header?
25. How does the select() function manage multiple connections?
26. What is a network protocol stack?
27. How does the accept() function work in a server?
28. What is a connection-oriented protocol?
29. Explain the different TCP congestion control mechanisms.
30. What is the purpose of SO_REUSEADDR in socket programming?
31. What are the advantages of using multithreading in a server?
32. What is the purpose of the htons() function?
33. How does a router function in a network?
34. What is the role of an HTTP server?
35. Explain the different layers of the OSI model.

You might also like