简体   繁体   English

有什么办法可以通过gen_tcp获取ether / ip头吗?

[英]is there any way to get ether/ip headers via gen_tcp?

is there any way to get not only body of incoming message. 有什么方法不仅可以获取传入消息的主体。 but also ether/IP headers of it? 而且还有ether/IP标头吗? Now i'm using gen_tcp and receive messages by active controlling process. 现在我正在使用gen_tcp并通过主动控制过程接收消息。

for now socket is opened via 'of_driver' in such way: 现在,通过“ of_driver”以以下方式打开套接字:

gen_tcp:connect(IpAddr, Port,  [binary, {packet, raw}, {active, false}],CONNECT_TIMEOUT)

As far as I know, you can't get Ethernet or IP headers through gen_tcp . 据我所知,您无法通过gen_tcp获得以太网或IP标头。 You could use the procket library to open a raw socket. 您可以使用procket库打开原始套接字。 (The {packet, raw} option passed to gen_tcp doesn't refer to a "raw" socket; it just means that gen_tcp doesn't try to interpret the TCP byte stream to split it into packets.) (传递给gen_tcp{packet, raw}选项没有引用“原始”套接字;这只是意味着gen_tcp不会尝试解释TCP字节流以将其拆分为数据包。)

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

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