diff src/main/java/jp/ac/u_ryukyu/treevnc/CheckDelayReply.java @ 414:3af5f4af2d63

Send data size for checkDelay
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 24 Nov 2015 02:18:51 +0900
parents 9c5874d0f37e
children
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CheckDelayReply.java	Thu Nov 19 17:18:23 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CheckDelayReply.java	Tue Nov 24 02:18:51 2015 +0900
@@ -13,25 +13,28 @@
     private long time;
     private int port;
     private int addressLength;
+    private int dataLen;
     private byte[] byteaddress;
     
-    public CheckDelayReply(long time, int port, String address) throws UnsupportedEncodingException {
+    public CheckDelayReply(long time, int port, String address, int dataLen) throws UnsupportedEncodingException {
         this.time = time;
         this.port = port;
         this.addressLength = address.length();
+        this.dataLen = dataLen;
         this.byteaddress = address.getBytes("UTF-8");
     }
     
     
     @Override
     public void send(Writer writer) throws TransportException {
-        ByteBuffer out = ByteBuffer.allocate(18 + addressLength);
+        ByteBuffer out = ByteBuffer.allocate(22 + addressLength);
         out.order(ByteOrder.BIG_ENDIAN);
         out.put(CHECK_DELAY_REPLY);
         out.put((byte)0);   // padding
         out.putLong(time);
         out.putInt(port);
         out.putInt(addressLength);
+        out.putInt(dataLen);
         out.put(byteaddress);
         writer.write(out.array(), 0, out.position());
         writer.flush();