|
|
@@ -114,6 +114,9 @@ public class Scrcpy extends Service {
|
|
|
}
|
|
|
|
|
|
public void StopService() {
|
|
|
+ if(mOkIoClient != null){
|
|
|
+ mOkIoClient.stopOkIoClient();
|
|
|
+ }
|
|
|
LetServceRunning.set(false);
|
|
|
stopSelf();
|
|
|
}
|
|
|
@@ -164,9 +167,9 @@ public class Scrcpy extends Service {
|
|
|
Socket socket = null;
|
|
|
VideoPacket.StreamSettings streamSettings = null;
|
|
|
int attempts = 50;
|
|
|
- while (attempts != 0) {
|
|
|
+ while (attempts != 0 && LetServceRunning.get()) {
|
|
|
try {
|
|
|
- Log.e("Scrcpy",attempts+" Connecting to screen push server port 7007:" + serverAdr);
|
|
|
+ //Log.e("Scrcpy",attempts+" Connecting to screen push server");
|
|
|
socket = new Socket(serverAdr, 7007);
|
|
|
dataInputStream = new DataInputStream(socket.getInputStream());
|
|
|
dataOutputStream = new DataOutputStream(socket.getOutputStream());
|
|
|
@@ -251,7 +254,7 @@ public class Scrcpy extends Service {
|
|
|
Thread.sleep(300);//连接比较耗时,适当延长重连时间。连接服务器7007端口,此端口用于推屏
|
|
|
} catch (InterruptedException ignore) {
|
|
|
}
|
|
|
-// Log.e("Scrcpy", e.getMessage());
|
|
|
+ Log.e("Scrcpy", "can't connect the device,tryed "+attempts);
|
|
|
} finally {
|
|
|
if (socket != null) {
|
|
|
try {
|
|
|
@@ -264,7 +267,7 @@ public class Scrcpy extends Service {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ //Log.e("Scrcpy", "what====================== ");
|
|
|
}
|
|
|
|
|
|
public interface ServiceCallbacks {
|