Mercurial > hg > Members > riono > TreeVNC_ja_comment
view src/main/java/jp/ac/u_ryukyu/treevnc/CheckDelayReply.java @ 234:8479ad028ec7
fix checkdelay send and get.
author | oc |
---|---|
date | Sat, 11 Oct 2014 02:47:17 +0900 |
parents | f4ea9ff04741 |
children | 0815ed7f54a7 |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import com.glavsoft.exceptions.TransportException; import com.glavsoft.rfb.client.ClientToServerMessage; import com.glavsoft.transport.Writer; public class CheckDelayReply implements ClientToServerMessage { private long time; private int port; private String address; private int addressLength; private byte[] byteaddress; public CheckDelayReply(long time, int port, String address) throws UnsupportedEncodingException { this.time = time; this.port = port; this.address = address; this.addressLength = address.length(); this.byteaddress = address.getBytes("UTF-8"); } @Override public void send(Writer writer) throws TransportException { ByteBuffer out = ByteBuffer.allocate(18 + addressLength); out.order(ByteOrder.BIG_ENDIAN); out.put(CHECK_DELAY_REPLY); out.put((byte)0); out.putLong(time); out.putInt(port); out.putInt(addressLength); out.put(byteaddress); writer.write(out.array(), 0, out.position()); writer.flush(); } }