数据库中char与varchar的区别
他们两个的底层数据结构都是线性表,但char是定长的,varchar是链表结构的。
过时的技术
===============================================================
GWT Google Web Toolkit 是一种允许开发人员使用 Java 编程语言快速构建和维护复杂但性能高的 JavaScript 前端应用程序的工具集,能够降低开发难度,尤其是与 Eclipse Google 插件结合使用时,优势更明显。有了 GWT可以使用 Java 编程语言编写 AJAX 前端,然后 GWT 会交叉编译到优化的JavaScript 中,而 JavaScript 可以自动在所有主要浏览器上运行。
k8s (全称:kubernetes)
Docker
https://my.oschina.net/jamesview/blog/2994112
serverless
https://www.npmjs.com/package/serverless
**
=================================================================================
java 通过发送 UDP-NetBIOS-NS 获取客户端的Mac地址
UdpGetClientMacAddr umac = new UdpGetClientMacAddr(sip);String smac = umac.GetRemoteMacAddr();
final UdpGetClientMacAddr umac = new UdpGetClientMacAddr(sip);//---长时间获取不到MAC地址则放弃ExecutorService exec = Executors.newFixedThreadPool(1);Callable<String> call = new Callable<String>() {public String call() throws Exception {return umac.GetRemoteMacAddr();}};try {Future<String> future = exec.submit(call);String smac = future.get(1000 * 1, TimeUnit.MILLISECONDS);loginMonitor.setMacAddress(smac);} catch (TimeoutException ex) {loginMonitor.setMacAddress("获取失败");logger.info("获取MAC地址超时");ex.printStackTrace();}// 关闭线程池exec.shutdown();//---
package shmc.commonsys.security.controller;import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.InetAddress;/*** 主机A向主机B发送“UDP-NetBIOS-NS”询问包,即向主机B的137端口,发Query包来询问主机B的NetBIOS Names信息。* 其次,主机B接收到“UDP-NetBIOS-NS”询问包,假设主机B正确安装了NetBIOS服务........... 而且137端口开放,则主机B会向主机A发送一个“UDP-NetBIOS-NS”应答包,即发Answer包给主机A。* 并利用UDP(NetBIOS Name Service)来快速获取远程主机MAC地址的方法**/public class UdpGetClientMacAddr {private String sRemoteAddr;private int iRemotePort=137;private byte[] buffer = new byte[1024];private DatagramSocket ds=null;public UdpGetClientMacAddr(String strAddr) throws Exception{sRemoteAddr = strAddr;ds = new DatagramSocket();}public final DatagramPacket send(final byte[] bytes) throws IOException {DatagramPacket dp = new DatagramPacket(bytes,bytes.length,InetAddress.getByName(sRemoteAddr),iRemotePort);ds.send(dp);return dp;}public final DatagramPacket receive() throws Exception {DatagramPacket dp = new DatagramPacket(buffer,buffer.length);ds.receive(dp);return dp;}public byte[] GetQueryCmd() throws Exception {byte[] t_ns = new byte[50];t_ns[0] = 0x00;t_ns[1] = 0x00;t_ns[2] = 0x00;t_ns[3] = 0x10;t_ns[4] = 0x00;t_ns[5] = 0x01;t_ns[6] = 0x00;t_ns[7] = 0x00;t_ns[8] = 0x00;t_ns[9] = 0x00;t_ns[10] = 0x00;t_ns[11] = 0x00;t_ns[12] = 0x20;t_ns[13] = 0x43;t_ns[14] = 0x4B;for(int i = 15; i < 45; i++){t_ns[i] = 0x41;}t_ns[45] = 0x00;t_ns[46] = 0x00;t_ns[47] = 0x21;t_ns[48] = 0x00;t_ns[49] = 0x01;return t_ns;}public final String GetMacAddr(byte[] brevdata) throws Exception {// 获取计算机名int i = brevdata[56] * 18 + 56;String sAddr="";StringBuffer sb = new StringBuffer(17);// 先从第56字节位置,读出Number Of Names(NetBIOS名字的个数,其中每个NetBIOS Names Info部分占18个字节)// 然后可计算出“Unit ID”字段的位置=56+Number Of Names×18,最后从该位置起连续读取6个字节,就是目的主机的MAC地址。for(int j = 1; j < 7;j++){sAddr = Integer.toHexString(0xFF & brevdata[i+j]);if(sAddr.length() < 2){sb.append(0);}sb.append(sAddr.toUpperCase());if(j < 6) sb.append(':');}return sb.toString();}public final void close() throws Exception {ds.close();}public final String GetRemoteMacAddr() throws Exception {byte[] bqcmd = GetQueryCmd();send(bqcmd);DatagramPacket dp = receive();String smac = GetMacAddr(dp.getData());close();return smac;}public static void main(String args[]) throws Exception{UdpGetClientMacAddr umac=new UdpGetClientMacAddr("172.19.1.198");umac=new UdpGetClientMacAddr("192.168.16.83");System.out.println(umac.GetRemoteMacAddr());}}
================================================================================
java通过执行系统命令,获取对方的mac地址
// 1.获取IP方式public static String getIpAddress(HttpServletRequest request) {String ip = request.getHeader("X-real-ip");if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("x-forwarded-for");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("Proxy-Client-IP");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("WL-Proxy-Client-IP");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("HTTP_CLIENT_IP");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getHeader("HTTP_X_FORWARDED_FOR");}if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {ip = request.getRemoteAddr();}return ip;}// 2.通过IP获取Mac地址;static String getMacAddrByIp(String ip) {String macAddr = null;try {Process process = Runtime.getRuntime().exec("nbtstat -a " + ip);BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));Pattern pattern = Pattern.compile("([A-F0-9]{2}-){5}[A-F0-9]{2}");Matcher matcher;for (String strLine = br.readLine(); strLine != null;strLine = br.readLine()) {matcher = pattern.matcher(strLine);if (matcher.find()) {macAddr = matcher.group();break;}}} catch (IOException e) {e.printStackTrace();}System.out.println(macAddr);return macAddr;}public static void main(String[] args) {String ip = "192.168.8.59";getMacAddrByIp(ip);}
————————————————
版权声明:本文为CSDN博主「qing_mei_xiu」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qing_mei_xiu/java/article/details/80745557
