Flask Socket Error 10053

时间:2016-03-23 13:28:14

标签: python sockets flask

我的Flask API存在问题,我不知道为什么。 我不时有这个套接字错误:

  Exception happened during processing of request from ('127.0.0.1', 52558)
  Traceback (most recent call last):
  File "C:\Python27\lib\SocketServer.py", line 295, in_handle_request_noblock
  self.process_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 321, in process_request
  self.finish_request(request, client_address)
  File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
  self.RequestHandlerClass(request, client_address, self)
  File "C:\Python27\lib\SocketServer.py", line 657, in __init__
  self.finish()
  File "C:\Python27\lib\SocketServer.py", line 716, in finish
  self.wfile.close()
  File "C:\Python27\lib\socket.py", line 283, in close
  self.flush()
  File "C:\Python27\lib\socket.py", line 307, in flush
  self._sock.sendall(view[write_offset:write_offset+buffer_size])
  [Error 10053] An established connection was aborted by the software in your host machine. 

我正在尝试执行以下操作:

  @app.route('/api/gener/', methods=['GET'])
  def gener():
   seed = 123    # seed for random generation
   Lambda = 100    # rate of demands
   alpha = 1.1   # decay factor for Zipf
   N = 100     # catalog size
   NB_demands = 200  # number of demands
   list = generate_demand(Lambda, alpha, N, NB_demands, seed)
   timee = 0

   for i in list:
    a = Content1.query.filter_by(id = i[1])
    filename = a[0].name
    time.sleep(i[0]-timee)
    visit = visits1(name=filename)
    db.session.add(visit)
    a[0].Hits += 1
    timee = i[0]
   db.session.commit()   
   return " Requests sent successfully"

有人可以帮忙!

0 个答案:

没有答案