jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes getting the IP address when system is Online[urgent] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting the IP address when system is Online[urgent]" Watch "getting the IP address when system is Online[urgent]" New topic

getting the IP address when system is Online[urgent]

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
Hi, I want to contact my friend's system which is about a 20 kms from my house.In case I want to share the files of his system,how can I do it?I 'm planning to write a socket file listening to a specific port& giving the file when I connect to that port.The problem is how can I connect to his system?Is it possible to do by knowing his IP address when connected online & create client socket to his system & read the file,or is there any other way to do it?please help me to do this,reply me as soon as possible.
Happy middling with java.
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
you can connect to your friends computer using a socket, yes.
here is what you need to do:
find out his ip:
you cant find out his ip in pure client-client model (if it is not fixed - and dial up connections dont have fixed ip's). but:
- you can use no-ip.com.
- have your program upload the ip in text format to an ftp server and when you want to connect to your friend you first download the file and extract the ip
- send him an eMail with your ip
then write a serversocket waiting for an incomming connection on a specified port. recieve the sockets out of ServerSocket.accept() method and get the Writers/Readers from the Socket. write your file in on your computer and read the file on the other...
there are a lot of tutorials and faq's around to see how this works.
I agree. Here's the link: http://aspose.com/file-tools
subject: getting the IP address when system is Online[urgent]
It's not a secret anymore!