| | |
| | | import java.net.InetSocketAddress; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | |
| | | import S7.S7control; |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.sun.net.httpserver.*; |
| | | |
| | | public class ThreadHttpServer { |
| | | //启动端口8080 |
| | | |
| | | private static final int port=8880; |
| | | private static final String Httpcontext="/demo"; |
| | | private static final int nThreads=8; |
| | | public static void mains() { |
| | | System.out.println("S7链接"); |
| | | S7control s7=new S7control(EPlcType.S1500, "192.168.30.14", 102, 0, 0); |
| | | System.out.println("S7:"+s7.readByte("DB34.0", 2)); |
| | | HttpServer httpServer; |
| | | try { |
| | | httpServer=HttpServer.create(new InetSocketAddress(port),0); |