String line="";
String reStr = "";
try{
String[] ars = new String[] { "python", "C:\\comm\\loraPrt.py", msgStr, commType, commCode, uCode};
Process pr = Runtime.getRuntime().exec(ars);
pr.waitFor();
InputStreamReader ir = new InputStreamReader(pr.getInputStream());
BufferedReader in = new BufferedReader(ir);
while ((line = in.readLine()) != null) {
reStr = line;
}
in.close();
pr.waitFor();
}catch(IOException e){
e.printStackTrace();
}catch(InterruptedException e){
e.printStackTrace();
}
req.setAttribute("msgStr", reStr);
RequestDispatcher dispatcher = req.getRequestDispatcher("index.jsp"); // 使用req对象获取RequestDispatcher对象
String reStr = "";
try{
String[] ars = new String[] { "python", "C:\\comm\\loraPrt.py", msgStr, commType, commCode, uCode};
Process pr = Runtime.getRuntime().exec(ars);
pr.waitFor();
InputStreamReader ir = new InputStreamReader(pr.getInputStream());
BufferedReader in = new BufferedReader(ir);
while ((line = in.readLine()) != null) {
reStr = line;
}
in.close();
pr.waitFor();
}catch(IOException e){
e.printStackTrace();
}catch(InterruptedException e){
e.printStackTrace();
}
req.setAttribute("msgStr", reStr);
RequestDispatcher dispatcher = req.getRequestDispatcher("index.jsp"); // 使用req对象获取RequestDispatcher对象
dispatcher.forward(req, res);
def lora_interface(msg, bc_type=0, area_code=0, user_code=0):
print (msg)
print ("ok2")
return '111'
reStr=lora_interface(sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))
print (reStr)