comparison src/main/java/jp/ac/u_ryukyu/treevnc/client/MyRfbProtoClient.java @ 36:b7d4d0349f99

write part of reconnection and remove warning.
author one
date Tue, 18 Sep 2012 17:23:19 +0900
parents 9d3478d11d3b
children c2f0b6907448
comparison
equal deleted inserted replaced
35:1b81deb0abb3 36:b7d4d0349f99
17 17
18 import com.glavsoft.exceptions.TransportException; 18 import com.glavsoft.exceptions.TransportException;
19 import com.glavsoft.rfb.encoding.EncodingType; 19 import com.glavsoft.rfb.encoding.EncodingType;
20 import com.glavsoft.rfb.protocol.ProtocolContext; 20 import com.glavsoft.rfb.protocol.ProtocolContext;
21 import com.glavsoft.transport.Reader; 21 import com.glavsoft.transport.Reader;
22 import com.glavsoft.viewer.swing.ParametersHandler.ConnectionParams;
23 22
24 public class MyRfbProtoClient extends MyRfbProto { 23 public class MyRfbProtoClient extends MyRfbProto {
25 final static int FramebufferUpdate = 0; 24 final static int FramebufferUpdate = 0;
26 final static int CheckDelay = 11; 25 final static int CheckDelay = 11;
27 final static String versionMsg_3_855 = "RFB 003.855\n"; 26 final static String versionMsg_3_855 = "RFB 003.855\n";
28 private static final int INFLATE_BUFSIZE = 1024 * 100; 27 private static final int INFLATE_BUFSIZE = 1024 * 100;
29 private Reader reader; 28 private Reader reader;
30 private EchoClient echoValue = new EchoClient(); 29 private String host;
31 private String host, treenum, parent, pHost, leaderflag; 30 private int port;
32 private int echoPort, port, acceptPort;
33 Socket clientSocket, sock; 31 Socket clientSocket, sock;
34 DataInputStream is; 32 DataInputStream is;
35 OutputStream os; 33 OutputStream os;
36 private ServerSocket servSock; 34 private ServerSocket servSock;
37 private ProtocolContext context; 35 private ProtocolContext context;
48 46
49 public MyRfbProtoClient(Reader reader, String host, String port) { 47 public MyRfbProtoClient(Reader reader, String host, String port) {
50 this.reader = reader; 48 this.reader = reader;
51 } 49 }
52 50
53 public void setParam(ConnectionParams connectionParams) {
54 pHost = connectionParams.hostName;
55 echoPort = connectionParams.portNumber;
56 }
57 51
58 public boolean readProxyFlag() throws TransportException { 52 public boolean readProxyFlag() throws TransportException {
59 int flag = reader.readUInt8(); 53 int flag = reader.readUInt8();
60 if (flag == 1) 54 if (flag == 1)
61 return true; 55 return true;
64 } 58 }
65 59
66 public byte[] readEchoPort() throws Exception { 60 public byte[] readEchoPort() throws Exception {
67 byte[] b = new byte[4]; 61 byte[] b = new byte[4];
68 reader.readBytes(b, 0, b.length); 62 reader.readBytes(b, 0, b.length);
69 // readFully(b);
70 return b; 63 return b;
71 } 64 }
72 65
73 66
74 int castByteInt(byte[] b) { 67 int castByteInt(byte[] b) {
87 return servSock.accept(); 80 return servSock.accept();
88 } 81 }
89 82
90 void initServSock(int port) throws IOException { 83 void initServSock(int port) throws IOException {
91 servSock = new ServerSocket(port); 84 servSock = new ServerSocket(port);
92 acceptPort = port; 85 // acceptPort = port;
93 } 86 }
94 87
95 @Override 88 @Override
96 public void selectPort(int p) { 89 public void selectPort(int p) {
97 int port = p; 90 int port = p;