Need help to find the ip address of other host

Hello Team,

I am new to ruby. I want to find the ip address of other system. For example:- i am executing my code from server wevrs1234 and i want ip address of server apvrs1234 and store it in variable. Please help me to get this. Thanks in advance

I’m curious. How are you executing code on a remote server without knowing its IP address to begin with?

In any case, I’d probably run a system command based on what OS is running on the target system. So, for example, for Linux, if I’m looking for the internal ip address:

ip = `hostname -I`
puts ip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs