Getting host name by TIdStack.LocalAddress

We are usingIndy component.
We use LocalAddress property of TIdStack
to get hostname.It works fine when we are not on
internet.But when we are on internet,it does't give
any value?
Can someone provide solution

Regards