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

C/C++ API Documentation | 2025.2

# ClientApi::SetPort( const char * )

Sets the port to be used to open this connection.

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

## Notes

`SetPort()` does not permanently change the `P4PORT` value in the environment. The new setting applies only to new connections established by calling this `ClientApi` object’s `Init()` method.

## Example

The following example demonstrates setting a new port value before initializing the connection.

    ClientApi client;
    Error e;

    client.SetPort( "magic:1666" );
    client.Init( &e );

Your search for returned results