File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes how can i write a servlet to connect to a fixed url periodically? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how can i write a servlet to connect to a fixed url periodically?" Watch "how can i write a servlet to connect to a fixed url periodically?" New topic
Author

how can i write a servlet to connect to a fixed url periodically?

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!
chanoch wiggers
Author
Ranch Hand

Joined: May 24, 2001
Posts: 245
do a search for applet=> servlet communication which should give you an idea of how to poll for the ip address
btw, a servlet is not very appropriate for this because a servlet is request driven. You could probably write a servlet that creates a thread and runs your polling server inside that thread. You could set the servlet to load on startup and instantiate the server as part of instantiation.
Alternatively, and this is much preferred, if yo uare paying for ADSL, then it shouldnt cost much more to have static ip instead of a DHCP based service surely? Most DHCP services ban you from having a server running anyway...
but this sounds more appropriate as a "server" application than a servlet application. Basically you need to write a program that checks for this value and updates it in a database, or whatever, and a Servlet (which is request driven) is not really appropriate for an always on program. If I was


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
 
 
subject: how can i write a servlet to connect to a fixed url periodically?
 
Similar Threads
problem in simple chat application.
write a servlet connect to a address automatically?
how to connect to other machine rather than localhost.
naive server ip connection question
Correct CN for the SSL Certificate for HTTPS Configuration