Welcome to Software Ninja blog - your ultimate destination for mastering software development and data manipulation. Explore cutting-edge techniques and expert tips to sharpen your coding skills and become a data virtuoso. Let's embark on a journey of discovery together!
Friday, May 3, 2013
Clojure: What is my IP address?
I needed to get the IP address of the current host and came across an article Detect your host IP with Clojure which had some good ideas. Unfortunately, this code does not take into account some of issues like network interfaces that are not up. My box is a Windows 7 64-bit box with VirtualBox installed as well as sometimes being docked and sometimes working wirelessly. Using that code as a base, I wrote this code:
This code returns a seq of vectors of IP address and the interface name. It only returns interfaces that are up and are not the loopback.
Subscribe to:
Posts (Atom)