XQuartz: Enable ‘Allow connections from network clients’ via command line
Thanks @nohillside♦ and @dan for your answers.
In my case the command defaults write org.macosforge.xquartz.X11.plist nolisten_tcp 0 had had no effect. After some investigation I've figured out that the plist filename is a bit different in my system. So the command that ultimately worked for me is:
defaults write org.xquartz.X11.plist nolisten_tcp -bool false

Note that macosforge has been shutdown and projects moved to other places - so removing macosforge from the default name makes sense.