I want to set the ipaddress in variable using scala. I have tried below scenario. I did not get exactly what I was looking for.
val sysip = System.InetAddress.getLocalHost();
Can you please help?
import java.net._
val localhost: InetAddress = InetAddress.getLocalHost
val localIpAddress: String = localhost.getHostAddress
println(s"localIpAddress = $localIpAddress")
You can find more details via this link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With