FindClient Method  
 

Return the socket handle for the client session with the specified moniker or client ID.

Syntax

object.FindClient( Client )

Parameters

Client
An integer value that specifies the handle to the client session or a string value that specifies a client name.

Return Value

An integer value which specifies the socket handle for the client session. If the specified moniker does not match an active client session, the method will return a value of -1 and the value of the LastError property will indicate the cause of the failure.

Remarks

The FindClient method returns a handle to the client session identified either by its moniker or client ID. The handle value that is returned can be used in conjunction with other methods that require it, such as the Read and Write methods.

If the Client parameter is a string, it is considered to be a client moniker and the method will search the table of connected clients and return the handle for the session that matches the specified moniker. A moniker can be assigned to the client session by setting the ClientName property from within an event handler such as the OnConnect event. Monikers are not case-sensitive, and they must be unique so that no client socket for a particular server can have the same moniker. The maximum length for a moniker is 127 characters.

If the Client parameter is an integer, it is considered to be a client ID and the method will return the handle for the client session that matches that ID. The ID for a client session can be obtained using the ClientId property from within an event handler such as the OnConnect event. Each client connection that is accepted by the server is assigned a unique numeric value, and unlike the socket handle for the client session, a client ID will not be reused throughout the life of the server.

See Also

ClientCount Property, ClientHandle Property, ClientId Property, ClientName Property