comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 411:8bff0bfaec3a

wait for monitor socket to be created
author Carl Byington <carl@five-ten-sg.com>
date Fri, 24 Oct 2014 17:48:43 -0700
parents e2a56e383bad
children 057854c77217
comparison
equal deleted inserted replaced
410:e2a56e383bad 411:8bff0bfaec3a
173 Log.i(TAG, "bound to service"); 173 Log.i(TAG, "bound to service");
174 174
175 try { 175 try {
176 InetAddress serverAddr = InetAddress.getByName(LOCALHOST); 176 InetAddress serverAddr = InetAddress.getByName(LOCALHOST);
177 int tries = 0; 177 int tries = 0;
178 while (tries < 5) { 178 while (tries < 10) {
179 try { 179 try {
180 Thread.sleep(100);
180 monitor_socket = new Socket(serverAddr, MONITORPORT); 181 monitor_socket = new Socket(serverAddr, MONITORPORT);
181 } 182 }
182 catch (IOException e) { 183 catch (IOException e) {
183 Log.e(TAG, "exception connecting to monitor socket", e); 184 Log.e(TAG, "exception connecting to monitor socket", e);
184 tries = tries + 1; 185 tries = tries + 1;
185 Thread.sleep(1000);
186 } 186 }
187 } 187 }
188 Log.i(TAG, "connected to monitor socket, send init " + init); 188 Log.i(TAG, "connected to monitor socket, send init " + init);
189 monitor_in = monitor_socket.getInputStream(); 189 monitor_in = monitor_socket.getInputStream();
190 monitor_out = monitor_socket.getOutputStream(); 190 monitor_out = monitor_socket.getOutputStream();