【问题标题】:Networking - sending and receiving data网络 - 发送和接收数据
【发布时间】:2016-05-21 00:07:27
【问题描述】:

这不可能是正确的地方,因为它不是纯粹的编程; 尽管如此,作为一个简单的网络开发人员,我发现自己很 对网络主题一无所知(维基百科通常混合 关于此事的不同主题),我觉得这是“必须”知道的。 当你写 google.com 时,我有点想知道会发生什么 在你的浏览器上,我不知道整个过程(我有一个调制解调器, 路由器和连接到它的几台计算机。让我们以我的案例为例):

You write characters into chrome -> 
there is some character encoding done to translate the address(ASCII or else) -> 
DNS does something, not sure -> 
your router receives a digital request from a computer's internet cable/WIFI, it saves the internal IPV4 address of     
the sender in order to know to which computer to respond back. it sends the digital data to the modem -> 
your modem receives digital data, and translates it from digital to analog ->
now your network provider does some work - > 
the google server receives a request from an IP address - > 
not sure how the google server handles the data, nevertheless it sends back data ->
service provider - > router gets translated digital data from the modem and remembers who sent the request, and sends it to the right person.

为了优化网络服务器或者编写更好的涉及网络的代码,也许每个初学者(比如我自己)都需要先了解这一点?感谢您的时间。 编辑:我确实阅读了维基百科的 OSI 模型,尽管它并没有我想象的那么有用。

【问题讨论】:

  • 在网上搜索OSI model
  • 我搜索了 WIKIPEDIA 的 OSI 模型 - 他们没有深入了解它。无论如何,谢谢。
  • 您需要超越定义站点并进入数百个对其进行深入解释的站点中的一些,例如ptgmedia.pearsoncmg.com/images/0131014684/samplechapter/…。您需要先清楚地了解网络的层模型,然后您可以在一些问题上填空。
  • 据我了解,OSI 模型是 7 个级别,而您只在第 2、3 和 4 层给了我 20 页的链接?我正在寻找一个按时间顺序排列的解释——例如,就像我上面的例子,当你写一个地址直到你从服务器取回数据时会发生什么。不过,谢谢。
  • 这是一个示例,它确实讨论了所有层。它会在“将所有层放在一起”部分中为您提供浏览器中发生的情况。

标签: networking encoding server ip


【解决方案1】:

我会尝试解释这个想法,尽管它可能会更复杂——这取决于你想深入到什么程度......

  1. 你写“www.stackoverflow.com”
  2. 您的操作系统将尝试将 www.stackoverflow.com 解析为 IP 地址
  3. 由于您的操作系统可能无法运行,因此需要询问 DNS 服务器
  4. 假设您使用外部 DNS(例如 IP=5.5.5.5 和您的 IP=10.10.10.10 位于不同的网络上),您的操作系统将检查它是否知道如何到达 5.5.5.5
  5. 您的 PC 上存在默认路由 0.0.0.0/0(这也称为“默认-gw”,包括所有互联网,它指向您的本地路由器
  6. 一个 IP 数据包将被发送到路由器 MAC 地址,其中 DNS IP 地址在目标中
  7. 您的路由器可能会将您的私有 IP 地址更改为自己的公共 IP 地址并将其发送给 ISP
  8. ISP 会将其路由到 Internet,直到到达 5.5.5.5,即 DNS
  9. DNS 会将 stackoverflow.com 解析回一个 IP 地址
  10. 您的 PC 现在知道如何将数据包发送到 stackoverflow.com
  11. 数据包将被发送到stackoverflow ip地址(104.16.36.249)到端口80(http)
  12. stackoverflow 网络服务器监听端口 80 上的请求
  13. 一旦数据包到达,它将生成一个响应数据包
  14. 它会以完全相同的方式将其发回给您

所有流量都可以通过像wireshark这样的网络捕获实用程序看到,你可以使用这些命令(windows)来验证......

ping stackoverflow.com

netstat -rn

ipconfig

nslookup

tracert -d

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多