Yes, but as a professional I really would encourage you not to use the file method... For one thing constantly pinging the hard drive every half second is a bit pointless...
If you use WinSock, you'll get a nice little event to latch onto one a computer tries to send info to you... And I think it stores the hostname that sent the info as a property too!
But, if you'll insist on using files, read about the Windows32 API. There's bound to be a function in their for finding the name of the computer you are on - so have the sending machine build it's name into the text file...
Hope that helped you out...
Martin