IConnectedUserInfoEx.HostName

Syntax

HostName: String;

HostName: string;

Description

The HostName property returns a name of the workstation from which the connection to the repository was established.

Example

Executing the example requires the Button component with the Button1 identifier.

Add a link to the Metabase system assembly.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    User: IConnectedUserInfoEx;
    Users: IConnectedUsersInfoEx;
Begin
    MB := MetabaseClass.Active;
    Users := MB.GetConnectedUsersEx;
    
If Users.Count = 0 Then
            Debug.Write(
"No connected users");
    
Else
        User := Users.Item(
0);
        Debug.Write(User.UserName);
        Debug.Write(User.HostName);
        Debug.Write(User.NetAddress);
        Debug.Write(User.UserOsName);
    
End If;
End Sub Button1OnClick;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    
Var
    MB: IMetabase;
    User: IConnectedUserInfoEx;
    Users: IConnectedUsersInfoEx;
Begin
    MB := Self.Metabase;
    Users := MB.GetConnectedUsersEx();
    
If Users.Count = 0 Then
            System.Diagnostics.Debug.Write(
"No connected users");
    
Else
        User := Users.Item[
0];
        System.Diagnostics.Debug.Write(User.UserName);
        System.Diagnostics.Debug.Write(User.HostName);
        System.Diagnostics.Debug.Write(User.NetAddress);
        System.Diagnostics.Debug.Write(User.UserOsName);
    
End If;
End Sub;

After executing the example clicking the button checks whether there are active users. If the number of active users is equal to 0, the console displays the message: No connected users. If there are connected users, the console displays information about the user with the 0 identifier: workstation name, OS user name, network computer address and platform user name.

See also:

IConnectedUserInfoEx