mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-22 09:02:16 -05:00
Update MediaWiki page '317 Protocol'
This commit is contained in:
parent
dfffc4c323
commit
6c57fa1c1d
@ -471,6 +471,31 @@ After the client processes every single player in the update player list, it end
|
||||
|
||||
==Game Protocol==
|
||||
The game protocol is the in-game communication of player actions between the server and client.
|
||||
|
||||
Server -> Client Packets use Output Streams. The Server writes information using the Output Streams, and then the Client Receives packet information with input stream's...
|
||||
|
||||
In order for a Packet to be sent to the client, from the server, a frame is needed to be created first. After the frame frame has been created, the information from the Output Streams, are written, so this makes the information sent to the client for the certain packet. A method in java, for sending the packets information would be like:
|
||||
|
||||
<pre>
|
||||
public void sendMessage(String message) {
|
||||
if(getOutStream() != null) {
|
||||
outStream().createFrameVarSize(253);
|
||||
outStream().writeString(s);
|
||||
outStream().endFrameVarSize();
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
The Client might will read it like:
|
||||
|
||||
<pre>
|
||||
if(packetType == 253) {
|
||||
String message = inputStream.readString();
|
||||
pushMessage("", 4, null);
|
||||
return true; // false to make the packet not work... true to make it work...
|
||||
}
|
||||
</pre>
|
||||
|
||||
<br/>
|
||||
===Server -> Client Packets===
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user