I created a simple server and client using Python. When i run it on my computer i works fine. But if i run the server on my comupter and try to open client on the other computer, it cant find my server.
Thanks for helping.
Do you know the IP for your server computer? Just making sure you know that 127.0.0.1 (or localhost) no longer works in this setup.
Are your computers behind a NAT?
Can you ping from one computer to another?
Do you have a firewall?
For BaseHTTPServer http://docs.python.org/library/basehttpserver.html you will want to pass in the empty string '' as the server address.
Related
I wonder and i've been trying everything to get my program with python sockets to work remotely. When I say remotely is like, I run the server in my computer and my friend at his house can run the client and connect to my server. Is this possible without using Hamachi? Pls let me know, because I'm already dying by trying so many things and installing and uninstalling programs.
You have to activate port forwarding on your router so that everything that comes on the specific port is forwarded to your local IP (and the port should be open).
I'm working a tutorial in Python 3.8 that involves sockets and networking. There is a server.py file and a client.py file. I took example code straight out of the Python doc for sockets to see if that would work, and it does not. The server starts and creates a socket and listens for the connection, but I get WinError 10061, the one where the target machine refuses the connection. My OS is Windows 10 and I'm using IDLE. I've looked at my Firewall and set a permission for pythonw.exe to be allowed through, but that has not helped. Anybody have any fixes for me to try? I can't really proceed until I can get the client and server connected.
I think I know what I’ve been doing wrong. I have been running both server and client files in the same console. I think I have to open two consoles and run one file in each so they can communicate.
(Doh!)
I’m at work so I can’t test it right now. Just in case anyone else has been befuddled by this .
Yes, I did not realize that each file had to run in its own instance of IDLE, but that makes perfect sense now. A socket won’t connect to itself!
I have such problem. I have local http server (BottlePy or Django), and when i use http:// localhost/ or http:// 127.0.0.1/ - it loads immediately. But when i use my local ip (192.168.1.100), it loads very long time (some minutes). What could be the problem?
Server works on Ubuntu 11.
you should take a look at
Slow Python HTTP server on localhost
similar issues has been resolved there.
It looks like that you have problems with DNS. can you check this idea running host 192.168.1.100 on the host? Please also check that other DNS queries being quickly processed.
Check /etc/hosts file for a quick-and-dirty solution.
I'm have an issue with running the built in Python server that comes with 3.1, this may or may not be an issue with Python, in fact it probably isn't.
I start my server in the correct directory with "python -m http.server 8000" as the documentation suggests (http://docs.python.org/release/3.1.3/library/http.server.html).
When I navigate to that port on my local network with another computer using the url 192.168.2.104:8000 (my local ip and the port) my page loads. When I use my global IP, however, it stops working. Port 8000 is forwarded correctly. I used www.yougetsignal.com to verify that port 8000 was open using my global IP. Why in the world would Chrome be saying "Oops! Google Chrome could not connect to [REDACTED]:8000" then? Other server applications (such as my Minecraft server) work just fine. Is there something I'm missing? Furthermore, why would yougetsignal connect to my port but not Chrome?
With most routers ports are only mapped when someone connects from the outside (internet/WAN). You're testing it from your LAN so basically you're connecting to your router when you use your public IP. Ask a friend to test, i.e. from an outside connection.
Whenever i try to make a HTTP request to some url through my django application which is running on top of apache mod_python (Machine: Ubuntu 10.04 server edition, 64-bits), it gives a timeout error.
The strange thing is that it works fine on Ubuntu 10.04 server edition, 32-bits.
I feel there could be some proxy connection issue. But i am not sure how to resolve it, if that is the case.
What could be the issue? Can anyone please throw some light on this.
Thanks in Advance.
Run simple network analysis first,
tracert
ping
wireshark (for network analysis)
Check your firewall and proxy settings on the server and make sure the correct ports, routes and permissions are fine.
Step 1:
Try it in the python shell first. Just take whatever you're trying to do with urlopen and do it in the python shell. You need to simplify your test.
Step 2:
If it still doesn't work maybe it's network... trying pinging the domain.
# ping domain.com
Could be a DNS issue, try looking the domain up:
# nslookup domain.com
or
# dig domain.com
If this works try pinging the IP directly.
# ping 000.000.000.000
Without more details this is all I know to try.