Socket Programming.. Stream sockets (SOCK_STREAM) provide a reliable, bidirectional, byte-stream communication channel. Datagram sockets (SOCK_DGRAM) allow data to be exchanged in the form of messages called datagrams. Socket I/O can be performed using the conventional read() and write() system calls, or using a range of socket-specific system calls (e.g., send(), recv(), sendto(), and recvfrom()). By default, these system calls block if the I/O operation can’t be completed immediately. Nonblocking I/O is also possible, by using the fcntl() F_SETFL operation (Section 5.3) to enable the O_NONBLOCK open file status flag. #include <sys/socket.h> int socket(int domain, int type, int protocol); Returns file descriptor on success, or –1 on error #include <sys/socket.h> int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); Returns 0 on success, or –1 on error #include <sys/socket.h> int listen(int sockfd, int backlog); #include <sy...