• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client/Server Communication Problem

 
nithin chinni
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
nithin chinni
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic