I'm currently using Twisted 10.1 to receive and parse UDP packets, but the standard implementation of reactor.listenUDP() only gives me access to the packet data, and I need to get the packet length from the UDP headers.
I've tried out Twisted's pairudp.py example, but it fails with an "ImportError: No module named eunuchs.tuntap". Doing an apt-cache search for python-eunuchs comes up with nothing, and looking at Ubuntu's package search, I can see that python-eunuchs hasn't been a part of Ubuntu since Dapper, circa 2006.
In any case, the Twisted Pair project itself is listed on it's twistedmatrix.com page as unmaintained, so I would be quite hesitant to start a project using any of it's libraries.
Can anyone provide me with pointers or even a (working?) example on how I can do this using Twisted 10.1 / 10.2?
Update
As Glyph pointed out, I'm trying to solve a problem in a complex manner that can be solved simply. Since I can get th开发者_StackOverflowe length of the packet data using len(data), and since the length of a UDP packet header is 8 bytes, totalSizeOfUdpPacket = 8 + len(data).
*facepalm*
As Glyph pointed out, you're trying to solve a problem in a complex manner that can be solved simply. Since you can get the length of the packet data using len(data), and since the length of a UDP packet header is 8 bytes, totalSizeOfUdpPacket = 8 + len(data).
精彩评论