Chapter2 - Communication and Internet Technologies

communication

2.01 Data Transmission

Key Term

串行传输和并行传输

串行传输:将组成字符的各位串行依次地传输,使用一根数据线传输数据,一次传输1个比特,多个比特需要一个接一个依次传输;在串行传输中又分为同步传输和异步传输。

并行传输:字符编码的各位(比特)同时传输,也就是使用多根并行的数据线一次同时传输多个比特。

常见的并行和串行接口

并行接口 - PATA,Parallel Advanced Technology Attachment,并行高级技术附件接口,可用于连接硬盘、光驱、连接打印机、扫描仪等。 (早期硬盘传输技术,已经被SATA替代)

串行接口 - SATA,Serial ATA接口 (硬盘接口,消费级硬盘)

并行接口 - 并口,Parallel Port (一般用于连接打印机、扫描仪等,对应串口)

并行接口 - COM串行口(老式鼠标接口,已经被USB代替)

并行接口 - PCI,Peripheral Component Interconnect,外设部件互连接口,用于插接外置网卡、声卡、显卡和调制解调器卡等。(并行数据总线, 老式显卡使用PCI,现在都使用PCIE接口)

串行接口 - PCI Express,PCI E接口 (串行数据总线)

串行接口 - USB接口

串行传输和并行传输的优缺点

从原理上讲,在相同的工作频率下并行传输的传输速度远比串行传输大,但并行线路有一些难以克服的缺点,导致依靠并行线路的并行传输无法用于长距离通信。计算机与外界的长距离通信,例如与网络中的另外一台计算机进行通信时,只能使用串行传输。串行传输方式大有彻底取代并行传输方式的势头。SATA取代PATA,USB取代Parallel Port,PCI E取代PCI接口。

并行传输的优缺点:

  1. 成本高,并行传输如果每个时钟节拍发送多少个比特,则需要多少数据线(另外还需要多根控制线)。

    PATA(并行传输)连接线缆包含40根导线(16根数据线,24根用于接地和进行控制);SATA(串行传输)连接线缆包含7根导线(4数据线+3接地线)。如果长距离通信,从成本上来讲,并行通信是串行通信的数倍。

  2. 并行接口占用空间大,对应线缆多占用空间也会大。

  3. 信号线之间的干扰大,不能用于长距离传输。并行线路多,线路间会产生干扰。并排的信号线在进行高速传输时,会在每条信号线的周围产生微弱的电磁场,出现串音干扰,进而影响到其它信号线中的数据传输。传输距离越长,串音干扰越严重。

    PATA线缆的长度不能超过0.4米,而SATA线缆可以达到1米。

    并行传输只适合于短距离、要求传输速度快的场合使用。

  4. 传输频率低,如果传输频率高的话,数据线之间会产生很大的干扰,造成数据出错,即使为数据线添加屏蔽层,也不能保证屏蔽掉高频率产生的干扰。所以,并行传输的最高传输频率有一定限制。

Serial data transmission

serial transmission uses a single wire to transfer the data bits.

A single wire is cheap to build and can transmit data over long distances.

a 56K modem can transmit 57 600 bits per second.

Parallel data transmission

Parallel transmission uses several wires to transfer the data bits simultaneously.

Parallel transmission transfers data quicker than serial transmission.However, because there are more cables, parallel transmission is more expensive and is therefore limited to shorter distances.

Parallel transmission is quite simple to implement but, because it has multiple wires, interference can occur between them.

parallel transmission is generally limited to short distances of around 5 metres. Serial transmission is up to 100 metres.

For many years, parallel transmission was used for data transfer between computers and printers.

Today, parallel transmission has largely been replaced by high-speed serial transmission methods such as the Universal Serial Bus (USB), which transmits data much quicker than parallel transmission.

Parallel transmission is still sometimes used in simple computers such as integrated circuits (IC) where low costs, simplicity and speed are important factors.

单工通信、半双工通信、全双工通信

单工数据传输只支持数据在一个方向上传输;在同一时间只有一方能接受或发送信息,不能实现双向通信,举例:电视,广播。

半双工数据传输允许数据在两个方向上传输,但是,在某一时刻,只允许数据在一个方向上传输,它实际上是一种切换方向的单工通信;在同一时间只可以有一方接受或发送信息,可以实现双向通信。举例:对讲机。

全双工数据通信允许数据同时在两个方向上传输,因此,全双工通信是两个单工通信方式的结合,它要求发送设备和接收设备都有独立的接收和发送能力;在同一时间可以同时接受和发送信息,实现双向通信,举例:电话通信。

网卡的全双工(Full Duplex)是指网卡在发送数据的同时也能够接收数据,两者同步进行。这好像我们平时打电话一样,说话的同时也能够听到对方的声音,目前的网卡一般都支持全双工。

Hub(集线器) - 半双工
Switch(交换机) - 全双工
Router(路由器) - 全双工

Simplex transmission (单工通信)

In simplex transmissions data is sent in one direction only.

An example is a television broadcast, where data is transmitted to receiving televisions.

Full duplex transmission (全双工通信)

In full duplex transmissions data is sent in both directions at the same time.

An example is a telephone conversation where both people can speak to each other at the same time.

Half-duplex transmission (半双工通信)

In half-duplex transmissions data is sent in both directions but only one direction at a time.

An example is a walkie-talkie (two-way radio): both people can speak to each other but only one person can speak at a time.

Different methods of data transmission can be combined. For example, a modern network uses serial duplex transmission whereas a walkie-talkie uses serial half-duplex transmission. A mouse uses serial simplex transmission. You can also get parallel simplex, parallel duplex and parallel half-duplex transmissions too.

错误检测

在一些网站上下载文件的时候可以看到Checksum这种东西,用于对下载文件的完整性进行校验。比如在Apache POI上下载就会提供完整的校验文件。

Error detection and correction

Errors can occur when transmitting and storing data

checksum

A checksum is a simple method of error detection. The number of bits being transmitted is counted up and this numeric count is transmitted with the data. The receiver can then see if the same number of bits has arrived.

Parity check

A parity check uses a parity bit to make sure that that the data has been sent accurately.

The devices that the data is being transferred between will be set to check for even parity or odd parity before the data is sent.

check digits

A check digit is a method of error detection that is used on identification numbers such as barcodes, ISBNs and bank account numbers.

automatic repeat request

Automatic repeat request (ARQ) is a set of rules for error control when transmitting data.

When the device receiving the data detects there is an error with a packet, it automatically sends a request to the device transmitting the data to resend the packet. This resend request will be sent repeatedly until the packet is received error free or a limited amount of resend requests is reached.

2.02 security aspects

Key Term

计算机病毒

Malware这个单词来自于Malicious和Software两个单词的合成,是恶意软件的专业术语,专指那些泛滥于网络中的恶意代码。

Malware就是植入你电脑中的恶意代码,它可以完全控制、破坏你的PC、网络以及所有数据。在日益恶化的网络环境中忽略Malware的危害是一件非常不理智的行为。认识Malware有助于免受其侵害。

Malware包含了以下几个种类:

Malware

There are risks associated with using the internet that can be harmful to your computer such as malware.

example viruses and spyware.

Viruses

A virus is a program that is downloaded on to a computer without the user’s knowledge or permission.

The most common type of virus will replicate itself over and over until it bring your computer system to a halt.

A virus is often spread through sharing files and attachments on emails.

Spyware

spyware is software that is created to collect information on a user’s computer use through their internet connection.

The collection of the data is done without the user’s knowledge or permission and it is collected normally to be sold on for marketing purposes. It can also gather information such as passwords, bank details and credit card details.

Hacking

As well as the risks above users can also be exposed to hacking when using the internet.

A hacker is someone who tries to gain unlawful access to a computer or a network by writing a program that will do this.

A white hat hacker exposes security issues in a network or system, but not for unlawful reasons.

A black hat hacker is a hacker that gains access unlawfully.

计算机防护

防火墙

防火墙(Firewall),也称防护墙,是由Check Point 创立者Gil Shwed于1993 年发明并引入国际互联网(US5606668(A)1993-12-15)。

它是一种位于内部网络与外部网络之间的网络安全系统。是一项信息安全的防护系统,依照特定的规则,允许或是限制传输的数据通过。

杀毒软件

杀毒软件,也称反病毒软件或防毒软件,是用于消除电脑病毒、特洛伊木马和恶意软件等计算机威胁的一类软件。

杀毒软件通常集成监控识别、病毒扫描和清除、自动升级、主动防御等功能,有的杀毒软件还带有数据恢复、防范黑客入侵、网络流量控制等功能,是计算机防御系统(包含杀毒软件,防火墙,特洛伊木马和恶意软件的查杀程序,入侵预防系统等)的重要组成部分。

Protecting against the risks

Anti-virus software can be used to detect a virus attack on a computer system.

The anti-virus software will scan the computer’s hard disk for any virus attacks and it will remove any that it finds.

New viruses are constantly being developed so most anti-virus software will have an update function built into them.

firewalls are used to monitor transmissions coming into and transmissions going out of a computer or network.

Firewalls can be hardware based or software based. Hardware based firewalls are more difficult to compromise but are expensive, whereas software firewalls are cheap, can be easily updated, but can be disabled by a virus.

2.03 Internet principle of operation

Key Term

Internet service provider

The internet is a global wide area network (WAN) of interconnected computers and devices.

To access the internet we normally need an internet service provider (ISP). An ISP is a company that provides us with access to the internet, normally for a fee.

We then use a modem to connect our computer to the internet, using the connection provided by the ISP.

ISPs will have terms of service that a customer will need to adhere to when using the internet.

Internet browser

A browser is a program that allows the computer user to visit, retrieve and display the information that a webpage contains.

To access a website, the user inputs the website’s web address into the browser. This address is known as the site’s uniform resource locator (URL).

The URL is translated into the unique internet address of the web server that hosts the website.

Browsers also allow the user to navigate to different webpages on the website and to other websites via the use of hyperlinks.

Web Server

A computer that hosts a website is known as a web server. A web server may host many websites.

Retrieving information from a web server is known as downloading. Sending information to a website is known as uploading.

A computer that accesses information from a webserver is referred to as a client.

Accessing a website is known as a request. Web servers are designed to handle many requests from many clients simultaneously.

Requested information is downloaded from a web server in packets.

As well as hosting websites, web servers are also used to manage facilities such as data storage, online multiplayer gaming and email.

web servers can be forced offline through what are known as distributed denial of service (DDOS) attacks. With this type of attack, hackers flood the web server with millions of requests.

网络协议

ipv4 协议包的header头结构

-|------------->16<--------------|------------->16<--------------|
-|0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7|  
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | vesion| IHL   | TypeOfService |          TotleLength          |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |        identification         |flags|      FragmentOffset     |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |  Time to Live |    Protocol   |         Header Checksum       |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                       Source Address                          |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                    Destination Address                        |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                    Options                    |    Padding    |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Internet Protocols

Hypertext transfer protocol (http) is the core protocol that governs transmission of data via the internet.

It is an access protocol. Http works as a request–response action.

The actual transfer of the information is governed by another protocol. This is known as the transmission control protocol (TCP). TCP handles the transfer of the data and also checks to ensure the transmission is error free.

a secure version of http known as https is used. Https encrypts the messages making them extremely difficult to understand by anyone other than the intended recipient that might intercept them.

mark-up language

The transmission a client computer receives from a web server is often in the form of a hypertext mark-up language (HTML) document.

An HTML document consists of two parts: the content to be displayed and instructions on how to interpret that content.

Mark-ups are instructions on how content is to be formatted, structured and displayed by the browser.

The mark-ups are read and interpreted by the browser, but not displayed.

Mark-ups in HTML take the form of tags. Content that requires formatting in some way is tagged. Tags enclose the content, with an opening tag <> at the beginning of the content and a closing tag </> at the end.

cascading style sheets

Once created, the style sheet can be applied to any HTML document and the document will have its contents presented in the format stated by the style sheet’s mark-up instructions.

Internet Addresses

Ip Address

Networks and the internet use the transmission control protocol (TCP) for communication. Each device on a network has an address.

The device’s network address is known as its internet protocol address (IP address).

Each IP address consists of a 32-bit code. For ease of use, this code is broken down into four groups of three digits, each group being in the range 0 to 255.

192.168.001.255 ~ 11000000101010000000000111111111

Every device connected to the internet has an IP address.

IPv6 uses 128 bits to assign addresses. This has greatly extended the number of available IP addresses.

When using static IP addresses, each device is assigned a fixed (static) IP address.

With dynamic addresses, the device retains the assigned IP address for a limited period, known as a lease.

Uniform resource locator

A uniform resource locator (URL) is what we could recognise as a website address. It is made up of the access protocol (http or https) and a domain name

The URL is translated by a special type of web server, known as a domain name server, into the 32-bit binary IP address.

MAC 地址

以太网规定,连入网络的所有设备,都必须具有"网卡"接口。数据包必须是从一块网卡,传送到另一块网卡。网卡的地址,就是数据包的发送地址和接收地址,这叫做MAC地址。

每块网卡出厂的时候,都有一个全世界独一无二的MAC地址,长度是48个二进制位,通常用12个十六进制数表示。

Mac Address

Each device on the network also has another address, which is known as its media access control address (MAC address).The MAC address uniquely identifies each device. This address is assigned by the device’s manufacturer, unlike an IP address which is assigned by the network.

A MAC address consists of six pairs of two-digit hexadecimal numbers, which are translated into a 48-bit binary code for use by the computer.

1a2f08a1234c ~ 000110100010111100001000101000010010001101001100

Cookies

Cookies are tiny pieces of data that are downloaded by a computer when it visits a website. Cookies are stored by the computer’s browser and are accessed by the website whenever it is visited by the client.

Some are designed to help keep track of whether or not a user has logged in to secure websites,

some cookies are used for purposes that can raise concern.

Some websites use cookies to track a user’s internet surfing activities and then tailor online adverts to match the user’s interests.

Others are used to store sensitive information such as passwords and credit card details, which can then be accessed at a later date.