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 help? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server help?" Watch "Server help?" New topic
Author

Server help?

Len Padson
Ranch Hand

Joined: Nov 21, 2011
Posts: 40
So, when you maek a ServerSocket, it sets the ip address to your ip address, right? so... like 192.168.1.1 or something. But with this, you can only network with computers on the same network. My question is: how can you make a ServerSocket that is available to computers on other servers. A practical example would be, a Chat Server so you could chat with a freind at another house.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

query involves Sockets, hence moving it to Sockets forum.


Mohamed Sanaulla | My Blog
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 122
When you instantiate a ServerSocket, you can optionally specify the ip address the socket binds (listens) to. The system you are running on will need to be addressable/accessible to the machine(s) you wish to connect from. The 192.* you specify is a private address so your friends pc can access it if you are able to give him/her access to your private network.

Baring that option, you'll want to find a way to expose your server system to the internet with a "public" IP address. Depending on your system and configuration just having a public ip address may not be enough (i.e. if you are running a firewall that blocks access, you may have to work with your router settings, etc). Do some searches on things like 'expose pc to internet' to get you started.

You'll also want to do some research into your options and the potential risks of doing so as you'll potentially open up your machine to access from anyone on the WWW.
Len Padson
Ranch Hand

Joined: Nov 21, 2011
Posts: 40
Brian Burress wrote:When you instantiate a ServerSocket, you can optionally specify the ip address the socket binds (listens) to. The system you are running on will need to be addressable/accessible to the machine(s) you wish to connect from. The 192.* you specify is a private address so your friends pc can access it if you are able to give him/her access to your private network.

Baring that option, you'll want to find a way to expose your server system to the internet with a "public" IP address. Depending on your system and configuration just having a public ip address may not be enough (i.e. if you are running a firewall that blocks access, you may have to work with your router settings, etc). Do some searches on things like 'expose pc to internet' to get you started.

You'll also want to do some research into your options and the potential risks of doing so as you'll potentially open up your machine to access from anyone on the WWW.




so theres no safe easy way to do it? haha
Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 147

Len Padson wrote:so theres no safe easy way to do it? haha

Look for the person at the party who can't shut up about their home network. Make friends with them. Have them set it all up for you - it's not too hard, and it would give them something more to talk about at their next party.


OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
Len Padson
Ranch Hand

Joined: Nov 21, 2011
Posts: 40
Pete Nelson wrote:
Len Padson wrote:so theres no safe easy way to do it? haha

Look for the person at the party who can't shut up about their home network. Make friends with them. Have them set it all up for you - it's not too hard, and it would give them something more to talk about at their next party.


haha very funny.
 
 
subject: Server help?