How to get remote address in magento 2 way?

Get Remote address in magento 2 by below code snippet,

Call function in template file by below way,