ClientApi::GetProtocol( const char * )

Get protocol information for this connection.

Virtual?

No

 

Class

ClientApi

 

Arguments

const char *v

the name of the protocol variable being checked

Returns

StrPtr *

a pointer to the variable’s value

Notes

If the variable is unset, the return value is null. If there is a value, it will be a number in most cases, but in the form of a StrPtr rather than an int.

Call GetProtocol() only after a call to Run(), because protocol information is not available until after a call to Run(). Calling GetProtocol() before Run() results in a return value of null, which looks misleadingly like an indication that the variable is unset.

GetProtocol() reports only on variables set by the server, not variables set by the client with calls to SetProtocol().

Example

The following example code checks whether the server is case-sensitive.

...
client.Init( &e );
...
client.Run();

if ( client.Dropped() )
{
    client.Final( &e );
}

if ( client.GetProtocol( "nocase" ) )
    printf( "Server case-insensitive.\n" );
else
    printf( "Server is case-sensitive.\n" );