aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Client/Server Communication Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Client/Server Communication Problem" Watch "Client/Server Communication Problem" New topic
Author

Client/Server Communication Problem

nithin chinni
Ranch Hand

Joined: Dec 02, 2010
Posts: 41
Hi, I am new to java and completely new to this networking. I tried to run this program in order to have a communication between client/server. when I tried it in the same network its working.Then, I have kept both programs in different networks and tried to communicate. This is where its throwing an error

java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.networking.DailyAdviceClient.go(DailyAdviceClient.java:15)
at com.networking.DailyAdviceClient.main(DailyAdviceClient.java:35)

I really doubt if its achievable or do I need to add something for this?Oh and by the way I have "Port Forwarded" the routers in both locations.
CLIENT PROGRAM:


SERVERPROGRAM:
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

The Java code certainly doesn't have any problems. We both got it working on one single machine (after I replaced the client's host). That means that the problem is on a network level.

Can you ping the server from the client machine?
Can you connect to the port using telnet? (Execute "telnet 65.0.XX.XXX 4242" from a command line; on Windows Vista / 7 you may have to use "Turn Windows features on or off".)


And could you please UseCodeTags in the future? Thanks!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
nithin chinni
Ranch Hand

Joined: Dec 02, 2010
Posts: 41
Rob Spoor wrote:The Java code certainly doesn't have any problems. We both got it working on one single machine (after I replaced the client's host). That means that the problem is on a network level.

Can you ping the server from the client machine?
Can you connect to the port using telnet? (Execute "telnet 65.0.XX.XXX 4242" from a command line; on Windows Vista / 7 you may have to use "Turn Windows features on or off".)


And could you please UseCodeTags in the future? Thanks!


Sorry about not using the code tags. I am new to forums. Well regarding the issue i will look into that. Thanks for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client/Server Communication Problem