Mercurial > hg > Applications > TreeVNC
comparison src/main/java/jp/ac/u_ryukyu/treevnc/TreeVncProtocol.java @ 326:1d4d5055a288
add error message, add assure stream close.
author | oc |
---|---|
date | Sun, 01 Feb 2015 15:30:17 +0900 |
parents | 7ef19658eb41 |
children | 293c35aa902b |
comparison
equal
deleted
inserted
replaced
325:cc9d33208f34 | 326:1d4d5055a288 |
---|---|
73 sendCommandToTheRoot(buf); | 73 sendCommandToTheRoot(buf); |
74 } | 74 } |
75 | 75 |
76 public void sendCommandToTheRoot(ByteBuffer buf) throws IOException { | 76 public void sendCommandToTheRoot(ByteBuffer buf) throws IOException { |
77 char[] charBuf = new char[12]; | 77 char[] charBuf = new char[12]; |
78 is.read(charBuf , 0, 12); // skip root's version header | 78 try { |
79 os.write(buf.array(), 0, buf.limit()); // send our command | 79 is.read(charBuf, 0, 12); // skip root's version header |
80 streamClose(); | 80 os.write(buf.array(), 0, buf.limit()); // send our command |
81 } finally { | |
82 if(is != null && os != null) | |
83 streamClose(); | |
84 } | |
81 } | 85 } |
82 | 86 |
83 void streamClose() throws IOException { | 87 void streamClose() throws IOException { |
84 os.close(); | 88 os.close(); |
85 is.close(); | 89 is.close(); |