摘要:
#!/usr/bin/env python import socketdef test_socket_timeout(): s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) print "Default socket timeout:%s"% ... 阅读全文
摘要:
#!/usr/bin/env pythonimport socketdef convert_integer(): data = 1234 #32bit print "Original:%s =>Long host byte order:%s, Network byte order:\ order:%... 阅读全文
摘要:
#!/usr/bin/env pythonimport socketdef find_service_name(): protocolname = 'tcp' for port in [80,25]: print "Port:%s => service name: %s" %(port,socke... 阅读全文
摘要:
#!/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 ... 阅读全文
摘要:
1 #!/usr/bin/env python 2 #--*-- coding:utf-8 --*-- 3 # Python Network Programming Cookbook -- Chapter – 1 4 # This program is optimized for Python 2... 阅读全文
摘要:
#!/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... 阅读全文
摘要:
#!/usr/bin/env python#Simple server -Chapter 1 -server.pyimport sockethost = ''port = 51423s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)s.setso... 阅读全文