[nim-dev] Re: How to get the machine IP address

  • From: flyx <nim@xxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Thu, 3 Mar 2016 08:40:33 +0000

Which operating system?

Linux has `getifaddrs 
<http://man7.org/linux/man-pages/man3/getifaddrs.3.html>`_, but it doesn't seem 
to be wrapped in `posix <http://nim-lang.org/docs/posix.html>`_, so you have to 
wrap it yourself.

Windows has `GetAdaptersAddresses 
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa365915(v=vs.85).aspx>`_,
 which you also have to wrap yourself since it isn't part of `winlean 
<http://nim-lang.org/docs/winlean.html>`_.

There may be packages which I don't know of that make this easier.

Other related posts: