python实现socket server,pythonsocket,import socke
文章由Byrx.net分享于2019-03-23 07:03:17
python实现socket server,pythonsocket,import socke
import socket, tracebackhost = ''port = 51423s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)s.bind((host, port))s.listen(1)while 1: try: clientsock, clientaddr = s.accept() print 'Got connection from', clientsock.getpeername() # Process the request here # Close the connection clientsock.close() except KeyboardInterrupt: raise except: traceback.print_exc() continue
相关内容
- python调用os.exit()方法来终止进程,pythonos.exit,def outahe
- python __setattr__ 和 __dict__方法,__setattr___dict_,class acces
- Python list根据下标删除元素,pythonlist,python list的
- python错误重定向和终止进程,python重定向终止,import s
- Function defined outside the class,definedoutside,def f1(self,
- python类继承dict,python继承dict,class defaul
- Class operator add: instance + noninstance and noninstance + instance,
- Python类成员变量示例,python变量示例,class C1:
- python的getter和setter方法示例,gettersetter,class Cost_e
- python subprocess.Popen 环境变量,,在执行使用subproc
评论关闭