Jump to content

42 Exam 06 Guide

┌───────────┐ │ select() │◄───── Monitors all file descriptors └─────┬─────┘ │ ┌──────────────┼──────────────┐ ▼ ▼ ▼ [Server Socket] [Client 1] [Client 2] (New Connects) (Sends Data) (Idle/Silent)

You cannot bring notes into the exam. Practice writing the socket initialization, select() loop, and basic error handling from memory until it takes less than 15 minutes. 42 Exam 06

You are often provided with a main.c file (roughly 80–100 lines) that contains necessary boilerplate code and helper functions like extract_message and str_join . If the master socket is marked as ready

If the master socket is marked as ready by select() , a new client is trying to connect. Call accept() to generate a new client socket. Add this new socket to the master fd_set . Update max_fd if the new socket value is higher. Update max_fd if the new socket value is higher

Using select() (the standard for this exam) to monitor multiple file descriptors.

: Standard fd_set structures support up to 1024 file descriptors. Ensure your loops do not exceed FD_SETSIZE .

×
×
  • Create New...