Extracting Clientname from a Thin Client

I need to port over a program originally developed to run on client machines
to a Thin Client Transaction Server setup (no hard disk or on-board memory,
just a connection to a server).

One of the tasks I need to do is to determine the client name of the thin
client when the program is executed.

I was hoping that the Winsock API, gethostname, would work, but it extracts
the name of the server machine.

A tech-support person from the vendor could only come up with the DOS
variable, %clientname%.

Is there a Winsock API trick to finding the clientname in this situation?

TIA,
Jon Gabiou