Communication.sleela
lib/telephony-skya/Communication.sleela · 104 line(s) · sleela
<< lib/telephony-skya/Communication.sleela
SLeeLa Standard Library Definition.
Definition: Defines Communication, the Skya message-exchange Master Class —
client-side reach / send / receive with an honest coherence tally.
Communication is an emblematic Skya module and a NATURAL / LOADABLE MODULE
sharing the common module contract (load / loaded / moduleName / describe).
Where Servers stands ready and Network describes reach, Communication
performs the client-side exchange and keeps a simple, honest tally of what
was sent and received so a program can tell whether a conversation actually
completed. It uses the same portable VM socket primitives as SkyaClient
(connect / sockwrite / sockread / sockclose) across the explicit SLeeLa
VM/OS bridge. The runnable orchestration example lives in
telephony-skya/sleela/Communication.sleela.
Family: telephony-skya. Native VM/OS work crosses an explicit bridge. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
class Communication {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10303;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-07";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
static final String MODULE = "Communication";
int loadedFlag;
int sent;
int received;
int failures;
void load() { loadedFlag = 1; sent = 0; received = 0; failures = 0; }
boolean loaded() { return loadedFlag == 1; }
String moduleName() { return MODULE; }
String exchange(String host, int port, String message) {
int sock = connect(host, port);
if (sock < 0) { failures = failures + 1; return ""; }
sockwrite(sock, message);
sent = sent + 1;
String response = sockread(sock);
sockclose(sock);
if (response != null && response.length() > 0) {
received = received + 1;
return response;
}
return "";
}
boolean ping(String host, int port) {
String r = exchange(host, port, "PING SKYA/1");
return r.length() > 0;
}
boolean coherent() { return failures == 0 && sent == received; }
int sentCount() { return sent; }
int receivedCount() { return received; }
int failureCount() { return failures; }
String describe() {
return MODULE + " sent=" + sent + " received=" + received
+ " failures=" + failures + " coherent=" + coherent();
}
}