Network Programming Exam Q&A Guide
Network Programming Exam Q&A Guide
The TIME_WAIT state in TCP ensures that all packets from a session have been received and any delayed duplicates are invalidated before a connection closes completely. This prevents old connection instances from interfering with new ones and contributes to overall network stability by guaranteeing a clean connection termination .
TCP is reliable and connection-oriented, ensuring data integrity through error checking and acknowledgment of receipt (e.g., web browsing), while UDP is unreliable, connectionless, and does not guarantee delivery (e.g., video streaming). These differences impact applications' choice based on their need for reliability versus speed and efficiency .
IPv4 uses 32-bit addresses, supporting roughly 4 billion devices, reaching address exhaustion. IPv6, with 128-bit addresses, supports a virtually limitless number of devices, addressing current scarcity and preparing for future growth. IPv6 also offers improved security and simplified headers, positively impacting scalability and management in future infrastructures .
The TCP three-way handshake establishes a reliable connection by coordinating the transmission states between the client and the server. It begins with the client sending a SYN packet to request a connection. The server responds with a SYN-ACK packet, acknowledging the request and offering to establish a session. Finally, the client sends an ACK packet to confirm the connection, allowing data transmission to commence .
VPNs enhance network security by encrypting internet traffic, creating a secure tunnel for data transmission. This increases data confidentiality and ensures that sensitive information is inaccessible to unauthorized users, thereby reducing susceptibility to eavesdropping and enhancing overall privacy and security .
TCP manages congestion using mechanisms such as slow start, congestion avoidance, fast retransmit, and fast recovery. Slow start increases the congestion window gradually to avoid overwhelming the network. Congestion avoidance adjusts the window size more conservatively after reaching a threshold. Fast retransmit quickly resends lost packets upon detecting missing acknowledgments, and fast recovery allows recovery without restarting the slow start process, thus maintaining network stability .
Middleware acts as an intermediary layer that abstracts the complexity of network communications. It facilitates interaction between distributed applications by providing a consistent interface and managing aspects such as messaging, synchronization, and data translation, allowing applications to communicate without needing to handle low-level network details .
Routers maintain network functionality by directing data packets between different network segments, ensuring data reaches its appropriate destination through the most efficient paths. They play critical roles in traffic management, avoiding congestion, and ensuring security by filtering packets based on predetermined policies .
The select() function monitors multiple file descriptors to see if they are ready for reading or writing, enabling efficient management of multiple connections in a server. It blocks execution until one or more sockets become active. However, it's limited by the number of file descriptors it can handle and is less efficient in scaling to a large number of simultaneous connections compared to more modern techniques like epoll or kqueue .
DNS is essential as it translates human-readable domain names into IP addresses, enabling user navigation across the internet. Efficient DNS operations improve user experience by reducing access times through caching and optimizing lookup processes, thereby enhancing browsing speed and reliability .