1. Overview
Most network applications Divide: Client (client) and servers (server) complex network applications: Asynchronous callback communication, where the server initiates a request message to the customer. Protocol stack: Application protocol, TCP protocol, IP Protocol, Ethernet protocol LAN (local area Network,lan), WAN (wide area Network,wan). Routers are architecture devices for WANs. Internet: The largest wide area network today. POSIX: A standard that is adopted by most vendors.
2. A simple time to get the client program 1) Create socket socket function 2) specify the IP address of the server and port struct sockaddr_in servaddr; struct htons function, Inet_pton function 3) Establish a connection to the server Connect function 4) read in and output the server's answer read,fputs function Description: TCP itself does not provide a record end flag, if the application needs to determine the boundaries of the record, it will be implemented on its own. The server can be actively disconnected, when read returns 0, an end sequence is agreed, or the message has a length + content. 5) Terminates the program Exit function, which closes all open descriptors
Introduction (1)-Overview, a simple time to get the client program