Update MediaWiki page '135 Protocol'

This commit is contained in:
S 2012-12-23 00:13:20 +00:00 committed by moparisthebest
parent 7707b01495
commit c4b0e07123

View File

@ -3,34 +3,17 @@ This page refers to the RSC #135 client revision. You can find a partially refac
== '''Packet structure''' == == '''Packet structure''' ==
<pre>byte tempbuf[]; <pre>if (len >= 160 {
if (in.available() >= 2) { [byte] (160 + (len / 256))
len = in.read(); [byte] (len & 0xff)
if (len >= 160) } else {
len = (len - 160) * 256 + in.read(); [byte] len
} [byte] data[len - 1] // last byte
if (len > 0 && in.available() >= len) { len--; // skip it
if (len >= 160) {
opcode = in.read() & 0xff;
len--;
tempbuf = new byte[len];
in.read(tempbuf, 0, len);
put(tempbuf);
} else {
byte lastbyte = (byte) in.read();
len--;
if (len > 0) {
opcode = in.read() & 0xff;
len--;
tempbuf = new byte[len];
in.read(tempbuf, 0, len);
put(tempbuf);
put(lastbyte);
} else {
opcode = (lastbyte & 0xff);
}
}
} }
[byte] opcode
for (int i = 0; i < len; i++)
[byte] data[i]
</pre> </pre>
RSC-135 uses big-endian byte order exclusively. RSC-135 uses big-endian byte order exclusively.