Seems to me that "localhost" always points at the machine where the code is running. But perhaps you don't need a name which you'll use if you're going to make a TCP/IP connection to that machine? Perhaps you need it for some other purpose?
If you're gonna buy things, buy this thing and I get a fat kickback:
Free, earth friendly heat - from the CodeRanch trailboss