比较靠谱的方法, 通过构造UDP包获得本机IP地址
 
python -c "import socket;print([(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1])"

 

转载于:https://www.cnblogs.com/JiangOil/p/10512653.html

 

比较靠谱的方法, 通过构造UDP包获得本机IP地址
 
python -c "import socket;print([(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1])"

 

相关文章:

  • 2021-09-21
  • 2021-07-14
  • 2021-12-03
  • 2021-09-18
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-05-09
猜你喜欢
  • 2021-12-05
  • 2021-11-27
  • 2022-12-23
  • 2021-11-03
相关资源
相似解决方案