python socket
2016-02-11 18:39
543 查看
服务端
客户端
import socket s = socket.socket() host = socket.gethostname() port = 1234 s.bind((host, port)) s.listen(5) while True: c, addr = s.accept() print 'Got connection from', addr c.send('Thank you for connecting') c.close()
客户端
import socket s = socket.socket() host = socket.gethostname() port = 1234 s.connect((host, port)) print s.recv(1024)
相关文章推荐
- Python - Package os
- python3获取天气预报(转)
- Python+selenium的GUI自动化实现
- python logging模块详解[转]
- python编程常用模板总结
- Python中使用正则表达式
- Windows7基于Python3.5安装Ipython notebook(现称jupyter)
- python黑帽子 pydasm 配置
- 6.python模块(导入,内置,自定义,开源)
- 打造自己的 Python 编码环境
- python——动态类型简介
- python-rrdtool安装
- python2.7.8安装
- python 安装easy_install和pip
- 《Python学习手册》(二)
- 递归创建级联目录之Python_VS_PHP
- 《笨办法学Python》 第37课手记
- LeetCode刷题 (Python) | 328. Odd Even Linked List
- python实现井字棋游戏
- Python处理验证码第一篇(pytesser初探及报错处理)