aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Simple echo. Problem with connection to server. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Simple echo. Problem with connection to server." Watch "Simple echo. Problem with connection to server." New topic
Author

Simple echo. Problem with connection to server.

Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
Hello,

I wrote simple echo service. It works perfectly when i am using localhost but problem is when i want to connect to my server using another machine which uses different IP address. Client program don't even want to connect. He is never asking for message so problem is with connection but i don't understand why. I checked ports using netstat command and they were an open. Can you help me ?

Server:


Client:
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3739
    
  16
That code shows you using the localhost for both client and server, which you say works fine. If you want help you need to show us the code that isn't working.


Joanne
Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
I forgot change it in my example. I using the same code when i want to connect from another machine but off course in the server and client instead localhost i am using my ip address.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3739
    
  16
Dawid Skrzypczynski wrote:I forgot change it in my example. I using the same code when i want to connect from another machine but off course in the server and client instead localhost i am using my ip address.

Right. But have you got the format of the IP address correct ? Probably you have, but if people here assume you have when you haven't then we are just wasting time looking for other possible causes. If you had posted the actual code you are using in the first place and the IP address format is correct, we could be already investigating those other reasons.
Dawid Skrzypczynski
Ranch Hand

Joined: Jun 08, 2011
Posts: 52
Sorry, this is complete code that i am using.


Server:


Client:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Simple echo. Problem with connection to server.