SocketTools .NET Edition

InternetServer.ClientName Property

Gets and sets a unique string moniker that is associated with the current client session.

[Visual Basic]
Public Property ClientName As String
[C#]
public string ClientName {get; set;}

Property Value

A string moniker which uniquely identifies the client session. If no moniker has been specified for the client session, this property will return an empty string.

Remarks

A client moniker is a string which can be used to uniquely identify a specific client session aside from its socket handle. A moniker can be assigned to the client session by setting the ClientName property from within a class 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.

This property only returns a meaningful value when accessed from within a class event handler, or a method that has been invoked from within an event handler.

Example

The following example sets the moniker for the client session in the OnConnect event handler.

[CS]
private void Server1_OnConnect(object sender, SocketTools.InternetServer.ConnectEventArgs e)
{
    Server1.ClientName = "Client" + Server1.ClientId.ToString();
}
    

See Also

InternetServer Class | SocketTools Namespace