Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes HELP : Connecting to machine in different network Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HELP : Connecting to machine in different network" Watch "HELP : Connecting to machine in different network" New topic
Author

HELP : Connecting to machine in different network

Sachin Joshi
Ranch Hand

Joined: Mar 23, 2004
Posts: 43
Hi
I am facing a problem regarding connecting to machine in a different network. My application is using ServerSocket and Socket pair
for this communication. My ServerSocket is running on some machine in network A. My Client programs running on machines in
network B are trying to connect to the server programs. But I am getting
"java.net.ConnectException: Connection timed out: connect" exception on
"Socket sockClient = new Socket(p_strRemoteServerIp, p_iRemotePort);" this line.
1. There is no firewall between these 2 networks.
2. I can ping from machine in network B to machine in network A from command prompt.
3. My server machine running ServerSocket is having a only a single LAN Card i.e. having only 1 IP address.
Can anybody guide in this ?
Thanks,
Sachin
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Hello,
This exception is tipically thrown if no process is listening. Try running a telnet session against the server to see if it is listening where it ought to.


SCJP2. Please Indent your code using UBB Code
Sachin Joshi
Ranch Hand

Joined: Mar 23, 2004
Posts: 43
Originally posted by Jose Botella:
Hello,
This exception is tipically thrown if no process is listening. Try running a telnet session against the server to see if it is listening where it ought to.

Hi john,
Thanks for the reply.
I tried that too. If I execute telnet command to the machine running the ServerSocket, it shows it is that it is listening.
Do suggest me if you find anything else.
Sachin
Sachin Joshi
Ranch Hand

Joined: Mar 23, 2004
Posts: 43
Originally posted by Sachya Joshi:

Hi john,
Thanks for the reply.
I tried that too. If I execute telnet command to the machine running the ServerSocket, it shows it is that it is listening.
Do suggest me if you find anything else.
Sachin

Hi all,

Got my problem solved. Thanks John and others who you have put some time on it.
I just tried by changing the port number to 2000 and it worked. I still do not know why it was not working for initial port number 4444. :roll:

Sachin.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HELP : Connecting to machine in different network