Perforce 2004.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 is based on a client/server architecture. Users work on files in client workspace directories on their own machines; these files are transferred to and from a shared file repository located on a Perforce server. Every Perforce system uses one server and can have many client workstations.

The following programs do the bulk of Perforce's work:

Perforce client programs use TCP/IP to communicate with the Perforce Server. To use Perforce, you must supply your client program with the address and port of the Perforce server to which you want to connect. See "Setting up your environment to use Perforce" on page 21 for details.

Before you begin

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

If this is not the case (for instance, if you're installing Perforce for the first time), you must install the Perforce server before continuing. For an overview of how to set up a server, see "Installing Perforce" on page 143.

The installation information in this manual 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, read the full installation instructions in the System Administrator's Guide.

Setting up your environment to use Perforce

In order to connect to a Perforce server, you must supply your Perforce client program with two pieces of information:

To connect to a Perforce server, specify the host and port number by setting the P4PORT environment variable to host:port, where host is the name of the host on which the p4d server is running, and port is the port on which the p4d server 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

For information about setting environment variables for most operating systems and shells, see "Setting and viewing environment variables" on page 148.

If your site is already using Perforce, your system administrator might have already set P4PORT for you; if not, you'll need to set P4PORT yourself.

After you have set P4PORT to point to your server, test your connection to the Perforce server by using the p4 info command. See "Verifying the connection to the Perforce server" on page 23.

If your Perforce client program is running on the same host as the server, you can omit the host and specify only the port number. If the Perforce server is listening to the default port 1666, you need only specify the host name in P4PORT. If the Perforce server is running on a host named or aliased perforce, and is listening on the default 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>

Verifying the connection to the Perforce server

To verify your connection to the Perforce server, enter p4 info at the command line. If the P4PORT environment variable is set correctly, 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: 2004/06/10 12:11:47 -0700 PDT
Server version: P4D/FREEBSD/2004.2/62360 (2004/06/10)
Server license: P4 Admin <p4adm> 20 users (expires 2005/01/01)

The Server address: field shows the Perforce server to which p4 has connected, as well as the host and port number on which p4d is listening.

In the above example, the connection was successfully tested. If you receive an error message like this:

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

then the p4 client program failed to connect to p4d, either because the Perforce server wasn't running, or because your setting for P4PORT was incorrect.

If the value shown in the third line of the error message is perforce:1666 (as above), then P4PORT was unset; if the value is anything else, P4PORT was incorrectly set. In either case, you must change the value of P4PORT to point to your Perforce server.

Windows

On Windows platforms, use the command p4 set to set registry keys, rather than environment variables.

For instance, to connect to the server in the example above, use the command p4 set P4PORT=p4server:1818 from the Command Prompt.

Logging in to Perforce

Depending on how your system administrator has defined your server's security policy, you may need to log in to Perforce before you can run Perforce commands. For more about Perforce passwords and authentication, see "Perforce Passwords" on page 79.

Perforce system administrators should consult the System Administrator's Guide for details on how to determine what type of authentication is best for the users at your site.


Perforce 2004.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-2004 Perforce Software. All rights reserved.
Last updated: 08/19/04