• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Client/Server Communication Problem

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic