Raspberry Pi Refusing Connection to Bottle Server

Raspberry pi refusing connection to bottle server

Try starting bottle on the 0.0.0.0 interface rather than localhost. That makes it listen for incoming connections on all interfaces, whereas if you start on localhost it only listens for connections from the local host.

Can't connect to Flask web service, connection refused

Run your app like this:

if __name__ == '__main__':
app.run(host='0.0.0.0')

It will make the server externally visible. If the IP address of the machine is 192.168.X.X then, from the same network you can access it in 5000 port. Like, http://192.168.X.X:5000

Running daemonized Bottle app with ability to change server

(Answer is based on additional info from OP in comments.)

To run your server in the background and have it not exit when you log out, you can use nohup:

nohup python myscript.py &

MQTT Broker Connection Refused Error in Python

The solution is:

The Mosquitto default port connection is set to 1883 in the config file, where I was trying to connect through port 1884.

I thought that, this properties are set whenever you change the number. Which is not correct since they are static. not changing dynamically.(sure there is a way too.)

Apart from that, the API Broker and Broker port numbers have to be swapped. I don't know why but windows can bind on top of it without problems. but Mac OS and Linux are throwing Connection Refused error.

  • The Pycharm is launched with root privilege.
  • Firewall is checked, and it is disabled.
  • None of these ports are open, checked it with lsof.
  • Check config file of the Mosquitto, if the allow_annoymous is True
  • Control your port connections 10 times.

These are still valid check before going crazy. %90 of the problems are caused because of one of these issues.

If you have further help or questions, you can comment in here and I will try to help for future inquiries.

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

You already have a process bound to the default port (8000). If you already ran the same module before, it is most likely that process still bound to the port. Try and locate the other process first:

$ ps -fA | grep python
501 81651 12648 0 9:53PM ttys000 0:00.16 python -m SimpleHTTPServer

The command arguments are included, so you can spot the one running SimpleHTTPServer if more than one python process is active. You may want to test if http://localhost:8000/ still shows a directory listing for local files.

The second number is the process number; stop the server by sending it a signal:

kill 81651

This sends a standard SIGTERM signal; if the process is unresponsive you may have to resort to tougher methods like sending a SIGKILL (kill -s KILL <pid> or kill -9 <pid>) signal instead. See Wikipedia for more details.

Alternatively, run the server on a different port, by specifying the alternative port on the command line:

$ python -m SimpleHTTPServer 8910
Serving HTTP on 0.0.0.0 port 8910 ...

then access the server as http://localhost:8910; where 8910 can be any number from 1024 and up, provided the port is not already taken.



Related Topics



Leave a reply



Submit