Thanks Ian,

> First, what you're trying to achieve is probably impossible.  Due to
> the Same Origin Policy (aka SOP), you can only connect to the host

SOP is not in play here. All of the network activity is between the
server and the end devices, the client isn't doing anything except for
communicating with the server on standard ports.

> Second, what you're doing, assuming you ignore the SOP, is sort of a
> waste of time.  Why ping, then check the port, then try to login?

If I were writing an typical user application, I'd agree - but I'm
not. This is part of a troubleshooting toolset used for diagnosing
network and system issues. In this case, I'd argue that trying to log
into a system that I can't ping is the bigger waste of time (and a
longer timeout), but that's neither here nor there (besides, what's
the first thing most network people do when a user complains that they
can't log into a particular system?). Paramount in this toolset is the
ability to break things up into itty bitty tasks to facilitate
different diagnostic approaches.

>
> Use callbacks.  If you've got some kind of answer to the problems I
> outlined above, you need to create your own callback mechanism:
>
> public interface WhatNow {
>
>   void onSuccess();
>
>   void onFailure();
>
> }
>
> public void pingHost(String host, WhatNow wn){
>   return pingImp(host, wn);
>
> }
>
> private void pingImp(String host, final WhatNow wn) {
>   callPingService(host, new AsyncCallback<....>() {
>
>     public void onFailure(Throwable caught) {
>       wn.onFailure();
>     }
>
>     public void onSuccess(.... result) {
>       wn.onSuccess();
>     }
>   });
>
> }
>
> public void checkPort(String host, int port, final WhatNow wn){
>   ping(host, new WhatNow() {
>
>     public void onSuccess() {
>       checkPortImpl(host, port, wn);
>     }
>
>     public void onFailure() {
>       wn.onFailure();
>     }
>   });
>
> }
>
> // etc.

Ian - thank you very much and thanks taking the time for such a
detailed response! I think this WhatNow interface concept will work
out for me. I suspected there was a way, I just couldn't find it (not
enough Java under my belt yet).

Thanks,

-Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to