This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Server Socket Problem

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The name should be something like "www.hassan.com", not just "hassan". You could also use the IP address.
 
Ali Hassaan
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

reply
    Bookmark Topic Watch Topic
  • New Topic