Let’s talk about LAN. The most famous LAN is the Ethernet
Ethernet
host (adapter)
hub (port)
hub slavishly copies every bit that it receives on each port to every other port.
globally unique 48-bit address that is stored in a nonvolatile memory on the adpater.
frame: fixed number of header bits, followed by a payloadof data bits.
Every host adapter sees the frame, but only the destination host actually reads it.
bind function
used by servers to establish connections with clients
#include <sys/socket.h>
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
→ There is an int type, an constant struct sockaddr pointer, and a socklen type.
The bind function asks the kernel to associate the server’s socket address in addr with the socket descriptor sockfd. The addrlen arguemenet is sizeof(sockaddr_in). As with socket and connect, the best practice is to use getaddrinfo to supply the arguments to bind.