This interface is implemented by the connection object. Use it to control the individual client connection.
interface IConnection extends ${IDispatch} {
// Properties
readonly ${Client64}: boolean;
readonly ${Id}: number;
readonly ${ProcessId}: number;
readonly ${SessionId}: number;
readonly ${Sessions}: ${ISessionCollection};
readonly ${Source}: string;
readonly ${Status}: ConnectionStatus;
readonly ${UserName}: string;
// Methods
${Drop}(): void;
${DropAllSessions}(): void;
${SendCustomMessage}(message: string): void;
}
public interface IConnection : ${IDispatch}
{
// Properties
bool ${Client64} { get; }
ulong ${Id} { get; }
uint ${ProcessId} { get; }
uint ${SessionId} { get; }
${ISessionCollection} ${Sessions} { get; }
string ${Source} { get; }
ConnectionStatus ${Status} { get; }
string ${UserName} { get; }
// Methods
void ${Drop}();
void ${DropAllSessions}();
void ${SendCustomMessage}(string message);
}
struct IConnection : IDispatch
{
// Properties
VARIANT_BOOL ${Client64}; // get
unsigned __int64 ${Id}; // get
unsigned long ${ProcessId}; // get
unsigned long ${SessionId}; // get
${ISessionCollectionPtr#ISessionCollection} ${Sessions}; // get
_bstr_t ${Source}; // get
ConnectionStatus ${Status}; // get
_bstr_t ${UserName}; // get
// Methods
HRESULT ${Drop}();
HRESULT ${DropAllSessions}();
HRESULT ${SendCustomMessage}(_bstr_t message);
};
readonly Client64: boolean;
bool Client64 { get; }
VARIANT_BOOL Client64; // get
This property holds true
if the client is running a 64-bit operating system and false otherwise.
readonly Id: number;
ulong Id { get; }
unsigned __int64 Id; // get
This property holds a unique identifier of a connection. This identifier is guaranteed to be unique for this server only.
readonly ProcessId: number;
uint ProcessId { get; }
unsigned long ProcessId; // get
This property holds a process id of the user who established a connection.
readonly SessionId: number;
uint SessionId { get; }
unsigned long SessionId; // get
This property holds a session id of the user who established a connection.
readonly Sessions: ${ISessionCollection};
${ISessionCollection} Sessions { get; }
${ISessionCollectionPtr#ISessionCollection} Sessions; // get
Returns a collection of all connected sessions.
readonly Source: string;
string Source { get; }
_bstr_t Source; // get
This property returns the computer name a connection originates from.
readonly Status: ConnectionStatus;
ConnectionStatus Status { get; }
ConnectionStatus Status; // get
Returns a connection status. One of the following values is returned:
Status | Value | Description |
---|---|---|
ClientDisconnected | 0 | Client has already been disconnected and connection is closed. Connections are never re-used. |
ClientConnected | 1 | Client is connected. |
readonly UserName: string;
string UserName { get; }
_bstr_t UserName; // get
This property holds a user name of the user that established a connection.
Drop(): void;
void Drop();
HRESULT Drop();
Drops the current connection and all its monitoring sessions.
DropAllSessions(): void;
void DropAllSessions();
HRESULT DropAllSessions();
Forcibly closes all active monitoring sessions for this connection.
SendCustomMessage(message: string): void;
void SendCustomMessage(string message);
HRESULT SendCustomMessage(_bstr_t message);
message
This method sends a supplied text message to the client. A client will see this message in a pop-up window. An administrator may use this method to warn clients of the forthcoming server shutdown or session drop, for example.
Warning the user of the forthcoming shutdown.
$conn.SendCustomMessage('Prepare for disconnect. We are about to restart a server.')