Perforce 2002.2 User's Guide
<< Previous Chapter
Product Overview
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Perforce Basics:
Quick Start


Chapter 2
Connecting to the
Perforce Server

Perforce uses a client/server architecture. Files are created and edited by users on their own client hosts; these files are transferred to and from a shared file repository located on a Perforce server. Every running Perforce system uses a single server and can have many clients.

As mentioned earlier, two programs do the bulk of Perforce's work:

Each Perforce client program needs to know the address and port of the Perforce server with which it communicates. This address is stored in the P4PORT environment variable.

Before you begin


This chapter assumes that your system administrator has already set up a Perforce server (p4d) for you, and that it is already up and running.

If this is not the case (for instance, if you're installing Perforce from scratch), you'll also have to install the Perforce server before continuing. See the appendix, "Installing Perforce" on page 137, for information on how to install the server.

The information in the appendix is intended to help you install a server for evaluation purposes. If you're installing a production server, or are planning on extensive testing of your evaluation server, we strongly encourage you to read the full installation instructions in the Perforce System Administrator's Guide.

Setting up your environment to use Perforce


A Perforce client program needs to know two things in order to talk to a Perforce server:

These are set via a single environment variable, P4PORT.

Note

See "Setting and viewing environment variables" on page 144 for information about how to set environment variables for most operating systems and shells.

If your site is already using Perforce, it's possible that your system administrator has already set P4PORT for you; if not, you'll need to set it yourself.

Either way, after setting P4PORT to point to your server, you should verify your client's connection to the Perforce server with the p4 info command.

Telling Perforce clients where the server is

To use Perforce, you'll need to know the name of the host where p4d is located, and the number of the TCP/IP port on which it's listening.

Once you've obtained the host and port information, set your P4PORT environment variable to host:portNum, where host is the name of the host on which p4d is running, and portNum is the port to which it is listening. For example:

If the server is running on...
and is listening to port...
set P4PORT to:

dogs

3435

dogs:3435

x.com

1818

x.com:1818

The definition of P4PORT can be shortened if the Perforce client is running on the same host as the server. In this case, only the port number need be provided to p4. If p4d is running on a host named or aliased perforce, listening on port 1666, the definition of P4PORT for the p4 client can be dispensed with altogether. For example:

If the server is running on...
and is listening to port...
set P4PORT to:

<same host as the p4 client>

1543

1543

perforce

1666

<no value needed>

When P4PORT has been set, you should re-verify the connection with p4 info, as described below. Once this has been done, Perforce is ready to use.

Verifying the connection to the Perforce server

To verify the connection, type p4 info at the command line. If the P4PORT environment variable is correctly set, you'll see something like this:

User name: edk
Client name: wrkstn12
Client host: wrkstn12
Client unknown.
Current directory: /usr/edk
Client address: 192.168.0.123:1818
Server address: p4server:1818
Server root: /usr/depot/p4d
Server date: 2000/07/28 12:11:47 -0700 PDT
Server version: P4D/FREEBSD/2000.1/16375 (2000/07/25)
Server license: P4 Admin <p4adm> 20 users on unix (expires 2001/01/01)

The Server address: field shows which Perforce server to which the client has connected; it displays the host and port number on which p4d is listening.

In the above example, everything is fine. If, however, you receive a variant of this message:

Perforce client error:
        Connect to server failed; check $P4PORT.
        TCP connect to perforce:1666 failed.
        perforce: host unknown.

then P4PORT has not been correctly set. If the value you see in the third line of the error message is perforce:1666 (as above), then P4PORT has not been set at all; if the value is anything else, P4PORT has been incorrectly set. In either case, you'll need to set the value of P4PORT.

Windows

On Windows platforms, registry variables are preferred over environment variables, and you can set these with command p4 set.


Perforce 2002.2 User's Guide
<< Previous Chapter
Product Overview
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Perforce Basics:
Quick Start

Please send comments and questions about this manual to [email protected].
Copyright 1997-2002 Perforce Software. All rights reserved.
Last updated: 12/18/02