• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Socket connection program works for localhost but not for other ip  RSS feed

 
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have one socket connection program as
// For server



//for client



when I run this program it create connection and send and data from server successfully. But when I use other machine IP as

Socket sock = new Socket("10.22.35.32",13267);

then on client machine it shows error as connection time-out. and there is no connection established between server and client. Why is it so? I started server program on one pc and run client program from another pc.
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I interchange client and server then it works perfectly. But not work for other combination why is it so?
 
Sheriff
Posts: 21500
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a networking issue. Make sure you can ping the server machine from the client machine. If that works use telnet to check if you can connect to it: If that already fails then something is blocking access, probably a firewall either on the server machine, on the client machine or on a router between the two.
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob for response. Yes because of firewall it is blocking access.
 
Rob Spoor
Sheriff
Posts: 21500
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you need to add exceptions to the firewall, to allow this traffic.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!