Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get userName from IP address

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
I have written a client server chat App using UDP (Indy Components). I am having problems getting the username of the user who sends a message (not the local computer username).

What I need is a function like this:

GetUserNameFromIP(sIPAddress) : String;

I can get the IP address and Host Name, but this doesn't help me, as my end result needs to pop up a message like this:

Message from : [adam]

Message here


Any ideas?


------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
A machine may have many usernames. There may be a local Windows username, which gives access to a desktop and local files and there may be one or many domain logins with possibly different usernames. Being able to determine any of these usernames from a base windows install is unlikely.

You could easily write a small app that when interrogated via TCP returns the USERNAME environment string of the machine - this holds the current local username.

You may have more luck with interogating the local DHCP server - this would have a nice list of IP and MAC addresses, and possibly usernames as well.
 
You could of course have the client send the required
username to the server.

[bobafett] BobbaFet [bobafett]
Code:
if not Programming = 'Severe Migraine' then
                       ShowMessage('Eureka!');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top