getsockopt
Steve Holden
steve at holdenweb.com
Fri Dec 16 03:29:08 EST 2005
Fabian Deutsch wrote:
> Hello,
>
> my name is fabian and i'm a student from northern germany. right now i
> try to create som kind of decapsulation of esp-udp packets using python.
>
> therefor i need to use the socket.getsockopt (SOL_IP, IP_OPTIONS, 20)
> method. But al i get is some empty value. Nothin.
>
> Does someone know or have an working exmaple of how to use this method??
>
> The lines:
> s = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)
> s.bind(('',4500))
> while 1: # Run until cancelled
> message, client = s.recvfrom(1400) # <=256 byte datagram
> hdr = s.getsockopt (SOL_IP, IP_OPTIONS, 20)
> print "Client connected:", client
> print "HDR:" + binascii.hexlify(hdr)
>
Perhaps you're getting an empty string back because no IP options are
set in the received packets' headers?
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list