Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2026.1

# ClientApi::SetHost( const char * )

Sets the hostname to be used for this connection.

Virtual? | No |
Class | `ClientApi` |
Arguments | `const char *c` | the new hostname value
Returns | `void` |

## Notes

`SetHost()` does not permanently change the host name of the client or set `P4HOST` in the environment. The new setting applies only to commands executed by calling this `ClientApi` object’s `Run()` method.

## Example

The following example sets different hostnames and displays them with `p4 info`.

    ClientApi client;
    ClientUser ui;

    client.SetHost( "magic" );
    client.Run( "info", &ui );

    client.SetHost( "shire" );
    client.Run( "info", &ui );

Your search for returned results