Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting the IP address when system is Online[urgent]

 
netharam ram
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Netharam.
 
karl koch
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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.
greets,
karl
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic