As a follow-up to my original post, I managed to connect if I unplug the ethernet connection from A and B, and let both A and B use the WIFI connection from my mobile phone, by using the phone as a tethering hotstpot. I suspect that there is some firewall or some settings relative to the ethernet connection which prevent NoMachine from working.
Does this give any hint or where the problem may be?