mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-12-22 15:38:52 -05:00
Update MediaWiki page '135 Protocol'
This commit is contained in:
parent
7707b01495
commit
c4b0e07123
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user