Connecting to the server

To connect to the P4 Server for which the client computer is configured, your client application must call the client.Init() method; for example:

client.Init( &e );
if ( e.Test() )
   {
      printf("Failed to connect:\n" );
      ErrorLog::Abort(); // Displays the error and exits
   }
printf( "Connected OK\n" );

Your program only needs to connect once. After connecting, the application can issue as many P4 Server commands as required. If you intend to use tagged output, your program must call client.SetProtocol() before calling client.Init(). For details about using tagged output, refer to Tagged data.