aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes write a servlet connect to a address automatically? 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 "write a servlet connect to a address automatically?" Watch "write a servlet connect to a address automatically?" New topic
Author

write a servlet connect to a address automatically?

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
hello
my company have domain name,but not have ip address,the public website host in a rented space in a public server.wihtin my company also have a internal website,it host in my internal network,the internal server can connect to the public server by ADSL.
now we want my internal website is published to internet by a http link in my public website page,so that the other division of my company can visit the internal website, the critical is how can i make the public server learn my address.
i plan to write a servlet in my internal web,it periodically connect to the public server,and in the public server,i write another servlet to get the tempory public ip address( by getRemoteAddr()method),but how can i implement the first servlet that is used to connect to the public server?
thanks for any helps!
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
What you want is an initialisation servlet (eg <load-on-startup>1</load-on-startup>) which kicks off a TimerTask that fires every ten minutes or so. This TimerTask is an ordinary Java class which uses java.net.URL to fire a magic request (/secret/intranet/set_ip?123.312.231.321 or somesuch) at the public server.
- Peter
[ August 30, 2002: Message edited by: Peter den Haan ]
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
thanks very much
could you give me a more detailed instruction?and the code snippet of the TimerTask class?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: write a servlet connect to a address automatically?