Collections:
Code Bug in server.py in 3Dmol Source Code
Why am I getting the "Connection refused" error when accessing my local 3Dmol Viewer?
✍: FYIcenter.com
If you are getting the "Connection refused" error when accessing your hosted 3Dmol Viewer over the network, it's most likely caused by the code bug in the server's Python source code.
1. Make sure that your 3Dmol Viewer is running:
fyicenter$ curl http://localhost:5000 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="/static/viewer.html">static/viewer.html</a>
2. Make sure the firewall is open for port 5000:
fyicenter$ sudo firewall-cmd --zone=public --add-port=5000/tcp fyicenter$ sudo firewall-cmd --runtime-to-permanent fyicenter$ sudo firewall-cmd --zone=public --list-all public (active) target: default icmp-block-inversion: no interfaces: eno1 sources: services: cockpit dhcpv6-client http mountd nfs rpc-bind ssh ports: 5000/tcp protocols: ...
3. Try to connect from a remote computer
fyicenter$ curl http://192.168.1.10:5000 curl: (7) Failed to connect to 192.168.1.10 port 5000: Connection refused
4. Check the server Python source code. You see server is listening only to the default IP address of 127.0.0.1.
fyicenter$ tail server.py ... if __title__ == '__main__': parser = argparse.ArgumentParser(description='Run 3Dmol.js learning environment server.') parser.add_argument('-p','--port', type=int, default=5000, help='Port to run on (default 5000)') args = parser.parse_args() socketio.run(app,port=args.port)
5. Update the server source code to listen on all IP addresses:
fyicenter$ vi server.py ... if __title__ == '__main__': parser = argparse.ArgumentParser(description='Run 3Dmol.js learning environment server.') parser.add_argument('-p','--port', type=int, default=5000, help='Port to run on (default 5000)') args = parser.parse_args() socketio.run(app,host='0.0.0.0',port=args.port)
5. Update the server source code to listen on all IP addresses:
fyicenter$ kill %1 fyicenter$ python3 server.py & [1] 23051
6. Try again from a remote computer
fyicenter$ curl http://192.168.1.10:5000 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> ...
Your Online 3Dmol Viewer is ready to accept remote connections.
⇒ Missing 3Dmol-min.js on Local 3Dmol Server
⇐ Start Online 3Dmol Viewer on Linux
⇑⇑ 3Dmol.js FAQ
2023-02-19, 392🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1001313 SMILES: Received at FYIcenter.com on: 2022-05-13
Molecule Summary: ID: FYI-1000319 SMILES: CCc1ccc(NCCc2n[nH]c(C(C) C)n2)cc1Received at FYIcenter.com...
Molecule Summary: ID: FYI-1003558 Names: InChIKey: HFPZCAJZSCWRBC-UHFFFAOYS A-NSMILES: Cc1ccc(C(C)C)...
What is chem.nlm.nih.gov ChemIDplus Database? chem.nlm.nih.gov ChemIDplus Database contains over 108...
Molecule Summary: ID: FYI-1002279 Names: TARTARIC ACID; InChIKey: FEWJPZIEWOKRBE-UHFFFAOYS A-NSMILES...