6325浏览
查看: 6325|回复: 2

【网络编程】TCP/IP

[复制链接]
本帖最后由 iooops 于 2017-7-9 01:34 编辑

胖友们楼主我又来发帖了……(最近无时不刻感受到身上穷得叮当响而且还感觉什么都不会当然这是不相干的内容哎)

今天晚上楼主刚学了一下TCP/IP协议。特来分享。

TCP/IP一般有4 Layers.

1. Application Layer

包括有HTTP(Hypertext Transfer Protocol), FTP(File Transfer Protocol), SMTP(Simple Mail Transfer Protocol), SNMP(Simple Network Management Protocol)等协议传输数据到Transport Layer。

2. Transport Layer

通常就是TCP和UDP了。
TCP可靠,会完整地传输数据,不会损失一分一毫。就是把数据分割成一个个小包,每次确保送到,发现没送到就重送。
UDP不可靠,有可能会丢包。

3. Network Layer

最常见的就是IP(Internet Protocol)了,负责在网络上传输数据的一层。

4. Data Link Layer

会涉及到device drivers in the OS and the network interface card attached to the system。
貌似和OS相关。楼主懵逼躺枪。



但楼主大概明白,从我们在浏览器里输入某个IP地址,到我们得到网页的内容,之间发生了什么。


就是这个样子的:




箭头正着来一遍。

再反着来一遍。







再来科普一下Socket是啥 = =。

所谓Socket,就是串口(Port)+对应的IP地址。
Client的(Port+IP) + Server的(Port+IP)组成一个four tuple, 就成了一个connection。

原文如下:
On a particular machine, a port number coupled with the IP address of the machine is known as a socket. A combination of IP and port on both client and server is known as four tuple. This four tuple uniquely identifies a connection. In this section we will discuss how port numbers are chosen.


嗯楼主大概梳理了一下。嗯感觉清晰多了。
(虽然貌似很多技术细节还是一脸懵逼。 = =。)





扩展阅读:
http://www.thegeekstuff.com/2011/11/tcp-ip-fundamentals
http://www.csd.uoc.gr/~hy556/material/tutorials/cs556-3rd-tutorial.pdf
https://www.saylor.org/site/wp-content/uploads/2012/02/Computer-Networking-Principles-Bonaventure-1-30-31-OTC1.pdf

pATAq  版主

发表于 2017-8-28 17:02:57

大哥你有没有发现你的帖子挺水的1
回复

使用道具 举报

iooops  中级技匠
 楼主|

发表于 2017-10-12 12:23:59

pATAq 发表于 2017-8-28 17:02
大哥你有没有发现你的帖子挺水的1

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail