!7 static long timeout = 60000; static long networkLatency = 10000; sclass ConnectToServer extends DynBigNumber { long count; transient bool connected; void start { super.start(); thread "Connect" { while licensed { withMinTime(1000, r { try { S s = loadPageWithTimeout(butterBotURL(#1016548) + "/" + randomID() /* avoid spam block */ + hquery(+count), timeout+networkLatency); if (s == null) setField(connected := false); else { print("Page: " + s); setFields(connected := true, count := parseInt(s)); updateValue(); } } catch e { printShortException(e); setField(connected := false); updateValue(); } }); } } } void updateValue { setValue(connected ? str(count) : "?"); } }