20135234 Ma Qiyang-—— Information Security system design basics 13th Week study Summary

Source: Internet
Author: User

The 11th Chapter Network programming

11.1 Client-Server programming model

Basic operations: Transactions

When a client needs a service, it sends a request to the server to initiate a transaction.

After the server receives the request, it interprets it and operates its resources in the appropriate manner.

The server sends a corresponding message to the client and waits for the next request.

The client receives a response and processes it.

11.2 Network

(1) for the host: The network is an I/O device

Data received from the network is copied from the adapter through the I/O and memory bus to the memory, typically via DMA (direct memory access).

(2) Physically: The network is a hierarchical system based on geographical distance

The bottom: LAN (LAN), the most popular is the Ethernet,

Ethernet segment:

Includes some cables and hubs. Each cable has the same maximum bit bandwidth, and the hub replicates every bit that is received on one port to all other ports, so each host can see each bit.

Each Ethernet adapter has a globally unique 48-bit address stored on the adapter's non-volatile memory.

A host can send one segment: frame, to any other host in this network. Each frame consists of a fixed number of head bits (identifying the source and destination address and frame length of this frame) and data bits (payloads). Each host can see this frame, but only the destination host can read it.

With cables and bridges, multiple Ethernet segments can be connected to a larger LAN, known as bridged Ethernet. The bandwidth of these cables can be different.

Multiple incompatible LANs can be connected by a special computer called a router to form an Internet internetwork.

(3) Agreement

Important features of the Internet: the use of different technologies, non-compatible LAN and WAN composition, and can make it communicate with each other. The solution to communication between different networks is a layer of protocol software running on each host and router, eliminating the differences between different networks.

Two basic capabilities provided by the Protocol

Naming mechanism: Uniquely identifies a single host

Transfer mechanism: Defines the same way that data bits are bundled into discontinuous slices

11.3 Global IP Internet

TCP/IP protocol family

Mixed use of socket interface functions and UNIXI/O functions for communication

World-wide host collections

Characteristics:

The host collection is mapped to a set of 32-bit IP addresses

This set of IP addresses is mapped to a set of identifiers called Internet domain names

Processes on the Internet host can be connected through connections and processes on any other host

11.4 Socket Interface

11.4.1 function

Socket function

Connect function

OPEN_CLIENTFD function

Bind function

Listen function

OPEN_LISTENFD function

Accept function

11.4.2 echo Client and server samples

11.5 Web Server

11.5.1 Web Foundation

The interaction between the WEB client and the server is a text-based application-level protocol called HTTP (hypertext Transfer Protocol, Hypertext Transfer Protocol). HTTP is a simple protocol. A WEB client (that is, a browser) opens an Internet connection to the server and requests some content. The server responds to the requested content, and then closes the connection. The browser reads the content and displays it on the screen.

11.5.2 Web content

Web content can be written in a language called HTML (hypertext Markup Language, Hyper-text markup language). An HTML Program (page) contains directives (tags) that tell the browser how to display various text and graphics objects on this page.

The Web server provides content to the client in two different ways:

(1) Take a disk file and return its contents to the client. The disk file is called static content, and the process of returning the file to the client is called the service static content (serving static contents).
(2) Run an executable file and return its output to the client. The output generated by the runtime executable is called the content of the state (dynamic contents), while the process of running the program and returning its output to the client is called the service dynamic content (serving).

12th Chapter Concurrent Programming

12.1 Process-based concurrency programming

Summarize:

A concurrent process consists of a set of logical flows that overlap over time. In this chapter we learned about three different mechanisms for building concurrent programs: process, I/O multiplexing, and threading.

Processes are automatically dispatched by the kernel, and because they have separate virtual address spaces, there must be an explicit IPC mechanism for sharing data.

Regardless of the concurrency mechanism, synchronizing concurrent access to shared data is a difficult issue. The P and V operations on semaphores are proposed to help solve this problem.

Concurrency also introduces some other difficult issues. A function called by a thread must have a property called thread-safe.

20135234 Ma Qiyang-—— Information Security system design basics 13th Week study Summary

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.