2

I am trying to run a server in BeagleBone Black using CherryPy and following this tutorial http://docs.cherrypy.org/en/latest/install.html, and every time I run it I have this error message

ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(( '127.0.0.1',8080))already shut down

How can I turn it on again ?

MFB
  • 105
  • 8
  • Have you tried any other port than 8080? – molivier Mar 11 '16 at 08:50
  • I tried now to kill the processes in the port using sudo fuser -k 8080/tcp and now I don't see that error, But also I found nothing when I open the webpage of the port, I don't know if it is another problem or that command was the wrong one – MFB Mar 11 '16 at 08:51
  • Is the server starting correctly `ENGINE Serving on http://127.0.0.1:8080`. Do you try to access your BeagleBone from another computer? – molivier Mar 11 '16 at 08:58
  • Yes, I want to access it from another computer in the same network – MFB Mar 11 '16 at 09:08

1 Answers1

0

I tkink the port 8080 is already used. Your command is fine to kill a process running on particular port on Linux.

fuser -k 8080/tcp

If you try to access your device remotely you have to explicitly configure Cherrypy to bind on all interfaces:

import cherrypy

class HelloWorld(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

if __name__ == '__main__':
   cherrypy.config.update({'server.socket_host': '0.0.0.0'} )
   cherrypy.quickstart(HelloWorld())
molivier
  • 2,146
  • 1
  • 18
  • 20
  • I added that but still I can't connectTutorial - Hello World import cherrypy cherrypy.config.update({'server.socket_host': '0.0.0.0'}) cherrypy.quickstart() cherrypy.quickstart() class HelloWorld: def index(self): return "Hello world!" – MFB Mar 11 '16 at 09:11
  • Did you try to curl your page from localhost? Is it working? – molivier Mar 11 '16 at 09:13
  • Start your app. ssh your BeagleBone in another shell and `curl -v http://localhost:8080`. You should have `HTTP/1.1 200 OK`. – molivier Mar 11 '16 at 09:20
  • I did it exactly like that and run it , The output of the run is correct as in the tutorial but still in the http://0.0.0.0:8080 not available – MFB Mar 11 '16 at 09:22
  • I think the curl works but in 127.0.0.1 here is the output Hello world!* Closing connection #0 root@beaglebone:~# * About to connect() to localhost port 8080 (#0) -bash: syntax error near unexpected token `(' root@beaglebone:~# * Trying ::1... -bash: Desktop: command not found root@beaglebone:~# * Connection refused -bash: Desktop: command not found root@beaglebone:~# * Trying 127.0.0.1... -bash: Desktop: command not found root@beaglebone:~# * connected ...................... – MFB Mar 11 '16 at 09:25
  • at the end it prints hello world, but still I tried both 0.0.0.0:8080 and 127.0.0.1:8080 in my laptop and nothing yet – MFB Mar 11 '16 at 09:26
  • Your have to try http://BeagleBoneIP:8080. 0.0.0.0 is just to listen from any ip address. – molivier Mar 11 '16 at 09:27
  • Thanks it works now :) I really appreciate your help – MFB Mar 11 '16 at 09:53