标签:ESS odi ext try web服务 rev coding int ade
用python http.sever实现web服务时,绑定端口由于强制退出导致再次启动服务报错:临时解决办法:
查找端口被占用的进程,然后强制结束
lsof -i:9090
然后kill对应的进程
#--coding:utf-8--
from http.server import BaseHTTPRequestHandler, HTTPServer
import time
import socket
class CarServer(BaseHTTPRequestHandler):
def get_host_ip(self):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write("Hello World !".encode())
if name == "main":
socket.set
myServer = HTTPServer(("192.168.1.101", 9090), CarServer)
print(time.asctime(), "Server Starts - %s:%s" % ("a","b"))
try:
myServer.serve_forever()
except KeyboardInterrupt:
pass
[python] 解决OSError: Address already in use
标签:ESS odi ext try web服务 rev coding int ade
原文地址:http://blog.51cto.com/13831725/2132173