I made this program: http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
And it works perfectly if I put the server's hostname as 127.0.0.1 or my computers name (Ajay-PC).
However these 2 methods are LAN开发者_StackOverflow or local only not internet. So I changed it to my internet ip. 70.128.xxx.xxx etc. But it didn't work. I checked:
canyouseeme.org
and it said 4444 was CLOSED.
So I did a quick port forward.
Portforward: Name: My Java Program Start Port: 4444 End Port: 4444 Server IP: 10.0.0.12 <-- (Yeah this is my Local IP I checked)
then I tried canyouseeme.org AGAIN:
and it said 4444 was OPEN
I ran my server client program and it yet to work.
So my problem is the client server program is not working on the internet just locally. So something is blocking it and I don't know what. EDIT: It's not blocked because as I checked the port is open. But I am recieveing a IO exception not a UnknownHost
Computer: Windows Vista x64 Norton AntiVirus 2010
Thanks! I'll give best answer or whatever to who ever answers the best ;) :)
How do you have access to the internet? Maybe you have to configure your ADSL modem or your router/switch to forward the port 4444 to your computer.
I guess you are in the LAN if you are using a router connecting to your modem. And your computer connect to the router.
Try to connect to your modem which has your internet IP.
Have you checked that the client is connecting to port 4444 and your public IP? This is another common mistake most people make. If your port is open as you say above and the firewall is off, then there's nothing stopping you connecting.
Use Wireshark or WinDump to snoop the initial TCP handshake. Filter for packets with port 4444. Verify that the opening SYN packet is leaving your computer, that the opening SYN packet is returning to your computer, and to see what whether/how computer is responding to the opening SYN packet.
Note: if you experiment with these tools, you won't be able to use it trace if you use the localhost (127.0.0.1) and your PC IP (10.0.0.12) addresses - in these cases, the packets don't actually leave the computer and can't be snooped. Put the client and server on separate computers if you want to snoop packets on the LAN without involving the gateway.
精彩评论