## Server Chạy memcached:  Config:  Tải SDK 1.8 (không xài bản cao hơn). Config SDK:  Sửa module setting -- `8`:  Run ngon lành:  ## Client Sửa: res/ipConfig.json ``` {"server":"127.0.0.1","port":1101} ``` Khi chạy sẽ ra được cái này  Trong src/cmd/send/demo/ResponseRequestUserInfo.java phía server, ta sẽ thấy: ```java package cmd.send.demo; import bitzero.server.extensions.data.BaseMsg; import cmd.CmdDefine; import java.nio.ByteBuffer; import model.PlayerInfo; public class ResponseRequestUserInfo extends BaseMsg { public PlayerInfo info; public ResponseRequestUserInfo(PlayerInfo _info) { super(CmdDefine.GET_USER_INFO); info = _info; } @Override public byte[] createData() { ByteBuffer bf = makeBuffer(); bf.putInt(info.position.x); bf.putInt(info.position.y); return packBuffer(bf); } } ``` Nó gửi 2 Int. Trong src/modules/testnetwork/network/Packet.js phía client, ta sẽ thấy: ```java testnetwork.packetMap[gv.CMD.USER_INFO] = fr.InPacket.extend( { ctor:function() { this._super(); }, readData:function(){ this.token = this.getInt(); this.name = this.getString(); this.x = this.getInt(); this.y = this.getInt(); } } ); ``` Nó nhận 1 Int rồi 1 String mới tới 2 Int.. vậy bỏ 2 dòng đầu đi. Done.  //{"server":"120.138.65.108","port":10088}
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up