radinsky / broadlink-http-rest

Broadlink RM/RM2/RM Pro/RM3/BlackBean/A1 Web server with REST API (like..)
MIT License
156 stars 47 forks source link

raspberry pi error log #4

Closed cnliri1 closed 7 years ago

cnliri1 commented 7 years ago

Hello,

when i run the server.py,it report an error,

socket.error: [Errno 98] Address already in use

any suggestion regarding this issue?

pi@raspberrypi:~/broadlink/broadlink-http-rest $ sudo python server.pyTraceback (most recent call last):
  File "server.py", line 250, in <module>
    start()
  File "server.py", line 195, in start
    httpd = server_class(server_address, handler_class)
  File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
radinsky commented 7 years ago

Probably you have another server running on port 8080 (or some process already listening on that port).

You can update port number to something else in start function (server.py): def start(server_class=HTTPServer, handler_class=Server, port=8080): Just replace the 8080 with some other value like 8182 and use it in your API calls: http://localhost:8182/learnCommand/lampon

radinsky commented 7 years ago

I have updated the sources, now you can specify the server listening port in settings.ini. Just update the value of serverPort and use it in your api calls/http requests...

cnliri1 commented 7 years ago

thanks@radinsky work perfectly now