* sockets -- especially UDP - difference between TCP and UDP TCP -- connection oriented; stream oriented reliable but might not be timely socket bind listen accept then read/write or send/recv UDP -- message oriented unreliable but usually more timely socket bind recvfrom/recvmsg or sendto/sendmsg - in practice stream -- server listens for connections accept a client connection (new fd) bi-direction data flow on that fd recv or read send or write datagram -- server just binds to addr/port uses recv* (e.g., recvmsg) each message can come from a different client only difference between a server and a typical client is that the server binds to a well know port and the client doesn't (it usually just gets one assigned) typically would use recvfrom or recvmsg sendto or sendmsg * handling multiple clients - TCP -- use poll across all client fds + accept fd to figure out which ones to read from - UDP -- use recvfrom/recvmsg to get a dgram + sender's address use a data structure to keep track of active client addrs