传输层(TCP和UDP)读取/检查IP头(源IP,目标IP等)? [英] Do Transport Layer (TCP and UDP) reads/inspects IP headers (Source IP, Destination IP etc.)?

查看:305
本文介绍了传输层(TCP和UDP)读取/检查IP头(源IP,目标IP等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道一个TCP套接字由四元组条目标识:
src ip,
dest ip,
src port
dest port



TCP执行多路复用和从主机上运行的不同进程中解复用数据。



在解复用的情况下,目的地IP信息只存在于IP头中。传输层(TCP)如何读取Dest IP?



Plz解释我非常困惑?

在这种情况下称为 TCP ,就像TCP over IP()一样在 TCP / IP UDP / IP 是一样的)。事实上,[TC | UD] P和IP在所有主要的当前套接字实现中被代码化地交织在一起。

套接字本身从IP层向上工作,目标IP信息,只有套接字协议处理程序专门将其用于TCP。因此,通过调用

 套接字(PF_INET,SOCK_STREAM,IPPROTO_TCP)

(或其他语言中的等价物),您将创建一个使用TCP(第三参数)的IP套接字(第一个参数)。这意味着,套接字具有IP信息以及TCP信息,


We all know that a TCP socket is identified by a four tuple entry: src ip, dest ip, src port dest port

TCP does the job of Multiplexing and Demultiplexing the Data from/to differnt processes running on the host.

In case of Demultiplexing, Destination IP information is there only in IP Headers. How come Dest IP is read by Transport Layer (TCP)?

Plz explain I m very much confused?

解决方案

What is called TCP in this context, is in reallity TCP/IP as in TCP over IP (UDP/IP is the same thing). In fact, [TC|UD]P and IP are extremly interwoven codewise in all major current socket implementations.

The socket itself works from the IP layer upward, thus it has the Destination IP info, only the socket protocol handler specialises this to TCP. So by calling

socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)

(Or its equivalents in other languages) you will create an IP socket (first parameter), that uses TCP (3rd parameter). This implies, that the socket has the IP information as well as the TCP info,

这篇关于传输层(TCP和UDP)读取/检查IP头(源IP,目标IP等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆