It's been done a few different ways, but it's not simple.

You either need to go through a ping / parse cycle or use an additional DLL.

Try a search of the forums to find previous solutions, here's a pointer to get you started:
GetHostByAddr

The 3rd post has a sample script to get the DNS name from "ping".

There is also a DLL knocking about here.