python Programming Glossary: socket.inet_aton
How can I generate all possible IPs from a list of ip ranges in Python? http://stackoverflow.com/questions/17641492/how-can-i-generate-all-possible-ips-from-a-list-of-ip-ranges-in-python start end import socket struct start struct.unpack ' I' socket.inet_aton start 0 end struct.unpack ' I' socket.inet_aton end 0 return.. ' I' socket.inet_aton start 0 end struct.unpack ' I' socket.inet_aton end 0 return socket.inet_ntoa struct.pack ' I' i for i in range.. own import socket struct ip '0.0.0.5' i struct.unpack ' I' socket.inet_aton ip 0 i 5 i 1 socket.inet_ntoa struct.pack ' I' i '0.0.0.6' Example..
How to limit traffic using multicast over localhost http://stackoverflow.com/questions/2879046/how-to-limit-traffic-using-multicast-over-localhost socket.IPPROTO_IP socket.IP_MULTICAST_IF socket.inet_aton 127.0.0.1 recvSock socket.socket socket.AF_INET socket.SOCK_DGRAM.. socket.IPPROTO_IP socket.IP_ADD_MEMBERSHIP socket.inet_aton addr 0 socket.inet_aton 127.0.0.1 while 1 pkt Hello host 1 time.. socket.IP_ADD_MEMBERSHIP socket.inet_aton addr 0 socket.inet_aton 127.0.0.1 while 1 pkt Hello host 1 time 0 .format time.ctime..
How to validate IP address in Python? http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python question Don't parse it. Just ask. import socket try socket.inet_aton addr # legal except socket.error # Not legal share improve..
Multicast in Python http://stackoverflow.com/questions/603852/multicast-in-python 1 sock.bind '' MCAST_PORT mreq struct.pack 4sl socket.inet_aton MCAST_GRP socket.INADDR_ANY sock.setsockopt socket.IPPROTO_IP..
How to sort IP addresses stored in dictionary in Python? http://stackoverflow.com/questions/6545023/how-to-sort-ip-addresses-stored-in-dictionary-in-python
How can I check if an ip is in a network in python http://stackoverflow.com/questions/819355/how-can-i-check-if-an-ip-is-in-a-network-in-python quad string to long integer return struct.unpack 'L' socket.inet_aton ip 0 def networkMask ip bits Convert a network address to a.. ip net Is an address in a network ipaddr struct.unpack 'L' socket.inet_aton ip 0 netaddr bits net.split ' ' netmask struct.unpack 'L' socket.inet_aton.. ip 0 netaddr bits net.split ' ' netmask struct.unpack 'L' socket.inet_aton netaddr 0 2L int bits 1 1 return ipaddr netmask netmask share..
Convert an IP string to a number and vice versa http://stackoverflow.com/questions/9590965/convert-an-ip-string-to-a-number-and-vice-versa def ip2long ip Convert an IP string to long packedIP socket.inet_aton ip return struct.unpack L packedIP 0 the other way around socket.inet_ntoa..
|