Raw UDP packets using Twisted

I currently use Twisted 10.1 to receive and parse UDP packets, but the standard implementation of react.listenUDP () only gives me access to the packet data, and I need to get the packet length from the UDP headers.

I tried the Twisted pairudp.py example , but it failed with the ImportError: No module named eunuchs.tuntap. Performing an apt-cache search for python-eunuchs leads to nothing, and looking at the Ubuntu batch search , I see that python-eunuchs hasn’t been part of Ubuntu since Dapper, around 2006.

In any case, the Twisted Pair project itself is listed on twistedmatrix.com , since I'm not sure to start the project using any of its libraries.

Can someone provide me with pointers or even a (working?) Example on how I can do this using Twisted 10.1 / 10.2?

Update

As Glyph noted, I am trying to solve the problem in a complex way that can be solved simply. Since I can get the length of the packet data using len (data), and since the length of the UDP packet header is 8 bytes, totalSizeOfUdpPacket = 8 + len (data).

* Facepalm *

+3
source share
1 answer

, , . , len (data), UDP- 8 , totalSizeOfUdpPacket = 8 + len (data).

+2

All Articles