day30, network programming and various protocols

Network Programming     1. network communication protocol theoretical knowledge

        ? The purpose of the Learning Network Programming 

What is the Internet
network: a plurality of nodes interconnected by a spider web of fishing nets composed
calculated the Internet: some media connected to each other and consist of multiple computers over
the Internet exists is to share information in order to make

network programming : that the web-based application is written in the
purpose of learning network programming
to develop a network can be used to transfer application data

CS structure
to establish a network requires at least two computers, and then use the network to transmit data
1. Unicom network must
2. in one needs to access data must be mounted for the application to access data of
the application is called a client application (client)

on one side must be installed to provide data required for application sharing data of
the application is called the application server program (server)
abbreviated as C / S
for example: qq is a client server Tencent
Tencent video

B / S browser browser / server HTML text data are transmitted by this configuration

The ultimate goal is to learn network programming to write an application based on C / S structure of the

two conditions for communication must have
1. a physical transmission medium (twisted pair
optical fiber coaxial radio waves)
2. Protocol (Key )


communication protocol
by the sender and receiver agree on a common set of specifications

Why do we need agreement
which aims to correct the two sides can resolve data
such as internal communication: the two sides are in Mandarin
international communication: English


IBM DELL HP early years each the company has its own set of protocols which leads to different brands of computers connected to the network can not
then ISO proposed a set of open systems interconnection model OSI

physical layer physical connection is established through physical media can send 1010101 binary data but can not understand the simple binary
some disposable income must be clear, each section of what is meant by the binary

data link layer
Ethernet protocol works at the data link layer
1. how packet data (format data) is
sent each time a data frame
Each data frame comprises a head and a data
46-1500 data head18
head 802 comprises the source address in the Ethernet type data tag

maximum will be fragmented than 1518
2.MAC network address of each computer to be bound to each card includes a card provided with a globally unique MAC address
MAC may Navigate to any computer, but if I do not know in advance your card would need to be broadcast
to determine the correspondence between the network port and MAC address of


each of the first local area network is a network address of the last ip ip is a broadcast address
such as: 192.168 . .13 0 - 255 so the available range is: 1-254
router is also a switch


with a computer link-layer theory, the world will be able to connect to the same network
but we can not all devices connected to the same computer switch
broadcast Storm: when a lot of the same network of computers simultaneously transmit broadcast will form a network broadcast storm only to paralysis


question 1: There is no switch can support so many computer
question 2: You can not use the original broadcast

network layer
ip protocols work on the network Internet Pr otocol Address
ip protocol requires each device to a computer network Ip must be assigned an
address
ip is a logical address is not fixed may vary
the physical presence of the opposite there is a logical

format ip address
by three decimal 4 segments
0.0.0.0 - 255.255.255.255
]

concept of ip address to the network address in the mac address based on the network address can then have a narrow range of broadcast
so in the first three paragraphs ip address LAN network number is used to indicate where
after a while the host number is used to represent the host position in the LAN


ip address into network number and host number
can be located via a local area network to a certain number
and then a host computer through a number of positioning
such an action would be to any computer via ip global positioning

problem: a computer can not only run a network program requires that when the card receives the data, in the end which application data to

the transport layer
TCP / UDP work at this level
transport layer requirements of each application Tied a port number
The port number is an integer ranging from 0-655360-1024 which is reserved for the system is not recommended
port number can not be repeated
this point on it by a certain application on ip + port number for a global positioning computer


TCP Transmission Control Protocol
reliable transport protocol, how to guarantee reliable, after the completion of data occurs, we must wait for the recipient to return a reply message, send the data considered successful
if the other party does not return for some time, it will send the data again, ultra limit the number of missing links will be judged
based on the transmission link
asked how links
should occur data must first establish a link simply means that to find a way to reach each other,
how to select an optimal transmission path, is controlled by the routing protocol
to ensure reliable data transfer chamber must ensure that transmission path is available
to establish the link required three-way handshake:
three-way handshake is to determine the transmission available
but It is not guarantee reliable transmission so subsequent TCP protocol when transmitting data of a data segment for each segment requires confirmation
Break the link requires four to wave
to ensure that both the data transfer is complete, Why do we need one more, there may be some transmission end of the other side is not over benefits: ensure transmission reliability, data integrity drawback: because of the need to confirm the transmission of information, so the consumption of a large network relatively low efficiency scenarios: important data, online payment, text messages UDP protocol user datagram protocol unreliable transport UDP just sends no matter if it was received advantages: high transmission efficiency than TCP disadvantages: unreliable transport scenarios: the speed demanding, less demanding on the integrity of video calls, voice chat war game mostly UDP you card you normally play cards right people




















 

Guess you like

Origin www.cnblogs.com/WBaiC1/p/10932422.html