GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python_test/test51.py at master · Hanlen520/python_test Expand file tree/ Copy pathtest51.pyMore file actions 19 lines (16 loc) · 594 Bytes / Copy pathtest51.pyFile metadata and controls19 lines (16 loc) · 594 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!/usr/bin/env python3 # -*- coding: utf-8 -*- '练习UDP网络协议' __author__ = 'sergiojune' import socket # 此文件用于当服务器 # 创建socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # 第二个参数为指定udp协议 # 绑定端口,不需要监听 s.bind(('127.0.0.1', 9999)) print('await connect') while True: data, addr = s.recvfrom(1024) # 这个直接返回客户端的ip和请求信息 print('connect form %s:%s' % addr) # 发送数据回客户端 s.sendto(b'hello %s' % data, addr) # 第二个参数为发送到的ip |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |