views:

67

answers:

6

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 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 ;) :)

A: 

I turned off Nortons FireWall and everything and still doesn't work, whats wrong! :/

Maybe Windows Firewall? But nope I checked that and its off too.

AjayP
A: 

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.

Juliano
I stated in my first post that I already forwarded, and used a port open checker. So I'm guessing I'm past this correct?
AjayP
If the port open checker returns "Open", isn´t your program working? I think if it was not working, the port wouldn´t be open. What´s the exception message?
Juliano
IO Exception is all I know about it. The client cant read what the server is saying.
AjayP
Try to catch the Exception and print the message: try {...} catch(Exception e) { System.out.println(e.Message); }
Juliano
It says "connnection refused: connect"
AjayP
When you execute "telnet xx.xx.xx.xx 4444" in the command line, does it connect?
Juliano
No it doesnt connect even if the server is on
AjayP
Please look at the server code in the link provided and make sure it is something that would work with Telnet
AjayP
This should work. Is the message only "connection refused". Is there any error code like 10061, 10060 (if it's Windows)?
Juliano
I ran the same program in V C# its the 10061 or w/e code, but strange thing is even with the port being open its not working on the internet.
AjayP
I think you need to specify the bin address in the ServerSocket object. Look at http://java.sun.com/j2se/1.4.2/docs/api/java/net/ServerSocket.html#ServerSocket(int, int, java.net.InetAddress)
Juliano
A: 

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.

sza
Thanks that would probably work but I would like to keep the solution while still staying behind the router.Is this possible?PS: NetGear Wireless-N
AjayP
A: 

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.

Helen Neely
Oh sorry!! Let me update my first post THE PORT IS OPEN I'm getting a IOExcept not UnknownHostHere is my client code:kkSocket = new Socket("70.137.xxx.xx", 4444); this is 100% correct and the port is open but I recieve an IO exception so the client cant read anything.
AjayP
A: 

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.

Bert F
Good idea I'll try it and post results, will choose best answer if this helps works out.
AjayP
A: 

it said 4444 was CLOSED.

What element said that? Java? netstat? Router configuration?

What did it really say? How? Exception? Stack trace? Message?

EJP
I said what said its closed, it wasnt java. I used a open port tool on the web canyouseeme.org to check if the port was open, it was closed then I opened it but it's still not working so it must be a problem with my code.
AjayP
That site doesn't say that ports are closed. Hence the confusion. It might say they are unreachable, or not listening, or connection timed out.
EJP