parent
a023089b9d
commit
8e3b8d57f5
@ -0,0 +1,30 @@
|
|||||||
|
package UnitTest;
|
||||||
|
|
||||||
|
import com.dsideal.FengHuang.Util.SocketUtil;
|
||||||
|
|
||||||
|
public class SocketUtilTest {
|
||||||
|
|
||||||
|
public static void Open(String host, int port, String sb_id) throws Exception {
|
||||||
|
//开
|
||||||
|
String hexData = "16 00 34 F5 41 11 FE 82 0D 02 ? 00 00 00 00 00 00 01 00 00 01".replace("?", sb_id).replace(" ", "");
|
||||||
|
SocketUtil sender = new SocketUtil(host, port);
|
||||||
|
sender.sendHexData(hexData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Close(String host, int port, String sb_id) throws Exception {
|
||||||
|
//关
|
||||||
|
String hexData = "16 00 34 F5 41 11 FE 82 0D 02 ? 00 00 00 00 00 00 01 00 00 00".replace("?", sb_id).replace(" ", "");
|
||||||
|
SocketUtil sender = new SocketUtil(host, port);
|
||||||
|
sender.sendHexData(hexData);
|
||||||
|
}
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
String HOST = "10.10.21.18";
|
||||||
|
int PORT = 8001;
|
||||||
|
String sb_id = "6D FF";
|
||||||
|
for (int i = 1; ; i++) {
|
||||||
|
if (i % 2 == 1) Open(HOST, PORT, sb_id);
|
||||||
|
else Close(HOST, PORT, sb_id);
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue