I would like to be able to get the correct time for an application (my G1 is running on ATT, so with EDGE network the network time is not accurate).
I have tried the following code and do not get anything from the input stream even though a capture with wireshark shows the correct UTC time being returned.
If I set the URL to www.yahoo.com the input stream shows the yahoo html without any problem.
Does anyone know why I cannot read the input stream from one of the atomic server sites ?
Thanks in advance,
Kevin
I have tried the following code and do not get anything from the input stream even though a capture with wireshark shows the correct UTC time being returned.
If I set the URL to www.yahoo.com the input stream shows the yahoo html without any problem.
Does anyone know why I cannot read the input stream from one of the atomic server sites ?
// final String ATOMICTIME_SERVER="http://132.163.4.101:13";
// final String ATOMICTIME_SERVER="http://www.yahoo.com";
// NIST, Gaithersburg, Maryland (time-a.nist.gov)
final String ATOMICTIME_SERVER="http://129.6.15.28:13";
try {
System.out.println("before connection");
URLConnection conn = new URL(ATOMICTIME_SERVER).openConnection();
in = new BufferedReader
(new InputStreamReader(conn.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
try {
System.out.println("before connection");
URLConnection conn = new URL(ATOMICTIME_SERVER).openConnection();
in = new BufferedReader
(new InputStreamReader(conn.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
Thanks in advance,
Kevin