简体   繁体   English

网络中需要原始套接字

[英]Need of raw socket in network

What is the need of a raw socket. 什么是原始套接字的需要。 Apart from TCP and UDP when I want to use raw socket. 当我想使用原始套接字时,除了TCP和UDP。 The main difference is headers. 主要区别是标题。 In raw socket we create our own header. 在原始套接字中,我们创建自己的标头。 What is the use of that. 这有什么用。 And why ping and traceroute use raw sockets. 以及为什么ping和traceroute使用原始套接字。 What is the problem arrives if it use TCP or UDP. 如果使用TCP或UDP,会出现什么问题。

ping uses icmp which is specifically designed for network diagnosis, error reporting etc. which isn't for data transfer. ping使用的icmp专为网络诊断,错误报告等而设计,不适用于数据传输。 That is one of the reason why ping uses icmp . 这就是ping使用icmp的原因之一。 It also doesn't require connection to be established between hosts. 它还不需要在主机之间建立连接。 And doesn't require any server program to listen for any request. 并且不需要任何服务器程序来侦听任何请求。

Which packet traceroute uses is mostly implementation specific. traceroute使用哪个数据包主要traceroute实现。 But Linux version of traceroute does use packet other than ICMP like UDP or TCP SYNC packets. 但是Linux版本的traceroute确实使用ICMP以外的其他数据包,例如UDP或TCP SYNC数据包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM