mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-25 10:32:17 -05:00
Update MediaWiki page '317 Protocol'
This commit is contained in:
parent
6c57fa1c1d
commit
eaf30847d3
@ -471,31 +471,6 @@ 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