Introduction (1)-Overview, a simple time to get the client program

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.