Warning: session_start(): open(/var/lib/php/sessions/sess_sv6puo84ubkr22kot8h2ghqlk4, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass StefansOS_ConnectToServer {
DialogIO io;
volatile bool on;
Set subs = synchroLinkedHashSet();
VF1 onLine;
void start {
on = true;
connect();
doEvery_daemon(30000, r { if (io != null) io.sendLine("") });
}
void cleanMeUp { on = false; }
// only call once!
void connect {
thread "Connect" {
while (licensed() && on) {
try {
io = talkTo("smartbot.botcompany.de", 6000);
io.getSocket().setSoTimeout(30000+10000);
print("Connected.");
temp tempAfterwards(r { print("Disconnected.") });
io.sendLine(format("computerID=*", computerID()));
for (S channel : cloneList(subs)) io.sendLine(format("sub *", channel));
print("Sent computer ID: " + computerID());
S line;
while ((line = io.readLine()) != null)
pcallF(onLine, line);
} catch e { // pcall would also do an annoying message box
printShortException(e);
}
io = null;
sleepSeconds(5);
}
}
}
bool connected() { ret io != null; }
void sub(S channel) {
if (subs.add(channel) && io != null)
pcall { io.sendLine(format("sub *", channel); }
}
void connectWithSubs(S... channels) {
for (S channel : channels) sub(channel);
connect();
}
}