It is a firewall that blocks connections from the brick. The easiest way to fix the problem is to disable firewall by
sudo service ufw stop, but it's a bad idea in general. Instead, you could setup rules to allow.
I guess, Lego Mindstorm sends a broadcast request, and waits for incoming connections from anyone (from the brick in our case). That means, you need to allow incoming connections either:
- from an interface
- using a subnet
- from a specific IP
- to a specific port
- using a specific protocol (i.e. http, https, ssh)
- any combination of above.
So, one rule you could use is
sudo ufw allow from 192.168.0.6, since it's the address of your brick. But I don't know how the address is assigned to the brick, whether it is dynamic, and would you want to use it with another one (with different IP), so probably better way would be to find the port in use, and setup a rule for that. First, temporary disable firewall (
sudo service ufw stop), execute in terminal
sudo tcpdump -nni any src 192.168.0.6 and dst 192.168.0.6, and connect the app to the brick. You would see an info about packets going between your host and brick, the port is written right after IP of your PC, like …192.168.0.6.52382 > 192.168.0.1.80… Then you can use:
sudo ufw allow PortNumberYouGot # e.g. sudo ufw allow 21
or better yet is to allow only a specific subnet:
sudo ufw allow from 192.168.0.0/16 to any port PortNumberYouGot