Message Boards Message Boards

How to evaluate my IP address in a function?

Posted 8 years ago

I want to write a function which checks if my current IP address is the one I have defined as a parameter. Thus my question is how do I equate a variable to evaluate my current IP address? WolframAlpha["current geoIP location"] allows to retrieve the IP address, but I do not know how assign it to and store it as, a variable.

POSTED BY: Berry Pi
2 Replies
Posted 8 years ago

Thanks. I ended up using Interpreter["HexInteger"]@ StringPartition[StringReplace[$MachineAddresses[[9]], ":" -> ""],2][[3 ;; 6]]

POSTED BY: Berry Pi

lookup

 $MachineAddresses
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract