getsockopt

Fabian Deutsch fabian.deutsch at gmx.de
Fri Dec 16 08:32:09 CET 2005


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)


greetings and ta
- fabiand




More information about the Python-list mailing list