File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Server Socket Problem 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 "Server Socket Problem" Watch "Server Socket Problem" New topic
Author

Server Socket Problem

Ali Hassaan
Ranch Hand

Joined: May 16, 2001
Posts: 103
Hi All
Please tell me y the following not connecting client to server,server name is hassan,its working fine on 127.0.0.1
but not at servers IP or name.
InetAddress address=InetAddress.getByName("hassan");
socket=new Socket(address.getHostAddress (),4444);
Angela Lamb
Ranch Hand

Joined: Feb 22, 2001
Posts: 156
The name should be something like "www.hassan.com", not just "hassan". You could also use the IP address.
Ali Hassaan
Ranch Hand

Joined: May 16, 2001
Posts: 103
Hi Angela
Actually i m working on my system how can i gave www.hassan.com
Originally posted by Angela Ann:
The name should be something like "www.hassan.com", not just "hassan". You could also use the IP address.

Ariffin Ahmad
Ranch Hand

Joined: Aug 16, 2001
Posts: 84
Originally posted by Ali Hassaan:
Hi Angela
Actually i m working on my system how can i gave www.hassan.com

it suppose to works, even if just use 'hassan'. perhaps, u not setup your machines name correctly.
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
Originally posted by Ali Hassaan:

InetAddress address=InetAddress.getByName("hassan");
socket=new Socket(address.getHostAddress (),4444);

Could it be that you have a space after address.getHostAddress and the "()"?
Here is what I've done before with DataGramSockets...

I dont' think you need to have the "address.getHostAddress" either because you've already got the address from InetAdress.
Also, is there anything running to accept connections on port 4444?


Ryan Headley<br /><a href="http://www.sudovi.com" target="_blank" rel="nofollow">http://www.sudovi.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server Socket Problem
 
Similar Threads
Cleared SCWCD today..
terminate a client in between the communication with server when a condition is met.
Passed OCPJP with 75%
java.net.ConnectException: Connection refused:
WA #1.....word association