__MagicPower
Do one thing and do it best!

导航

 

2015年12月21日

摘要: #!/usr/bin/env python import socketdef test_socket_timeout(): s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) print "Default socket timeout:%s"% ... 阅读全文
posted @ 2015-12-21 16:19 __MagicPower 阅读(180) 评论(0) 推荐(0) 编辑
 
摘要: #!/usr/bin/env pythonimport socketdef convert_integer(): data = 1234 #32bit print "Original:%s =>Long host byte order:%s, Network byte order:\ order:%... 阅读全文
posted @ 2015-12-21 15:52 __MagicPower 阅读(184) 评论(0) 推荐(0) 编辑
 
摘要: #!/usr/bin/env pythonimport socketdef find_service_name(): protocolname = 'tcp' for port in [80,25]: print "Port:%s => service name: %s" %(port,socke... 阅读全文
posted @ 2015-12-21 15:30 __MagicPower 阅读(121) 评论(0) 推荐(0) 编辑
 
摘要: #!/usr/bin/env pythonimport socketfrom binascii import hexlifydef convert_ipv4_address(): for ip_addr in ['127.0.0.1','192.168.0.1']: packed_ip_addr ... 阅读全文
posted @ 2015-12-21 14:56 __MagicPower 阅读(172) 评论(0) 推荐(0) 编辑
 
摘要: 1 #!/usr/bin/env python 2 #--*-- coding:utf-8 --*-- 3 # Python Network Programming Cookbook -- Chapter – 1 4 # This program is optimized for Python 2... 阅读全文
posted @ 2015-12-21 14:38 __MagicPower 阅读(217) 评论(0) 推荐(0) 编辑
 
摘要: #!/usr/bin/env python#python network programming cookbook -- chapter -1#this program is optimized for Python 2.7 it may run on any#other python versio... 阅读全文
posted @ 2015-12-21 14:18 __MagicPower 阅读(191) 评论(0) 推荐(0) 编辑
 
摘要: #!/usr/bin/env python#Simple server -Chapter 1 -server.pyimport sockethost = ''port = 51423s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)s.setso... 阅读全文
posted @ 2015-12-21 12:15 __MagicPower 阅读(127) 评论(0) 推荐(0) 编辑