Monday, January 23, 2017

Ping on client side

I am trying to use the code in my client code

public PingObj pingUrl(final String address) {
PingObj po = new PingObj();
try {
final URL url = new URL("http://" + address);
final HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.setConnectTimeout(1000 * 10); // mTimeout is in seconds
final long startTime = System.currentTimeMillis();
final long endTime = System.currentTimeMillis();
if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
System.out.println("Time (ms) : " + (endTime - startTime));
System.out.println("Ping to " + address + " was success");
po.setTimeTaken(endTime - startTime);
return po;
} catch (final Exception e1) {
return po;

which uses, which cannot be used on the GWT Client side. I am new to this. How to handle these on client side?

Thanks in advance. 

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment