mac
2024-01-02 d1ebb94e1a17b7c25d4fcf73d85345d92cc86b5c
app/src/main/java/com/hdl/photovoltaic/internet/HttpServer/MyNanoHttpService.java
@@ -7,6 +7,9 @@
import androidx.annotation.Nullable;
/**
 * 本地服务器
 */
public class MyNanoHttpService extends Service {
    private MyNanoHttpServer myNanoHttpServer = MyNanoHttpServer.getInstance(null);
@@ -18,6 +21,11 @@
        try {
            myNanoHttpServer.start();
        } catch (Exception e) {
//            if (serverSocket.isBound() && !serverSocket.isClosed()) {
//                // Port is available
//            } else {
//                // Port is not available
//            }
            e.printStackTrace();
            startService(new Intent(this, MyNanoHttpService.class));
        }