Subject | Re: Concurrent Usage Limiting via Application |
---|---|
Author | Tom Conlon |
Post date | 2006-05-12T17:16:09Z |
> Being able to get a list of connected users with their IP address, OSHi there Stefan,
> user name, client application name/identifier and timestamp of
> connection would be my number one wish for any future release of
> Firebird. For me, that would be more important and helpful than, say,
> further speed improvements of the SQL query optimizer ...
> --
> Stefan Heymann
> www.destructor.de/firebird
I don't know if the following code is of any interest to you but we
use the first two when logging app queries - they return the LAN users
and their machine names (Windows).
function GetNetComputername: String;
var
buf: array [0..MAX_COMPUTERNAME_LENGTH] of Char;
bufsize: DWORD;
begin
bufSize := Sizeof(buf);
if GetComputername( buf, bufsize ) Then
Result := buf
else
Result := '';
end;
function GetLoginName : string;
var
Name : array [0..255] of char;
NameSize : DWORD;
begin
NameSize := sizeof(Name);
if not GetUserName (Name, NameSize) then
RaiseLastWin32Error;
Result := StrPas (Name);
end;
// UNTRIED
> How to get my internet ip and lan ip adress into delphi.....WSAStartup(MAKEWORD(1, 1), wsaData);
GetHostName(@AC, SizeOf(AC));
LocalNameEdit.Text:=AC;
host:=gethostbyname(@AC);
pCh:=iNet_ntoa(PInAddr(host^.h_addr_list^)^);
LocalIPEdit.Text:=pCh;
WSACleanup;
Tom