Perforce 98.2 p4 User's Guide
<< Previous Chapter
Concepts
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Quick Start: Basics

Chapter 2
Connecting to the p4d Server
Reference
This chapter assumes that both the p4d and p4 programs have been installed by a system administrator. Installation instructions can be found in Chapter 13.
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.

Two programs do the bulk of Perforce's work:

  • The p4d program is run on the Perforce server. It manages the shared file repository, and keeps track of users, clients, protections, and other Perforce metadata.

  • The p4 program is run on each Perforce client. It sends the users's requests to the p4d server program for processing, and communicates with p4d via TCP/IP.

Each p4 program needs to know the address and port of the p4d server that it communicates with. This address is stored in the P4PORT environment variable.

Verifying the Connection to the p4d Server


A p4 client needs to know two things in order to talk to the p4d server:

  • The name of the host that p4d is running on

  • The port that p4d is listening on.

These are set via a single environment variable, P4PORT. It is possible that your system administrator has already set P4PORT; if not, you'll need to set it yourself.

Example
Output from p4 info when correctly connected to the p4d 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: eds_elm
Client unknown.
Current directory: /usr/edk
Client address: 206.14.52.194:3119
Server address: margarine:1818
Server root: /usr/local/p4root
Server version: P4D-FREEBSD (12/13/96)
Server license: test 10 users

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

Example
Error from p4 info; the p4D server connection is incorrectly specified.
In the above example, everything is fine. If, however, you receive a variant of this message:

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.

95/98/NT
On Windows 95 and NT, registry variables are preferred over environment variables. Please see the environment variable section of the Command Reference, for details on using registry variables with Perforce.

Telling p4 Where p4d is


Before continuing, you'll need to ask your system administrator the name of the host that p4d is located on, and the number of the TCP/IP port it's listening on. Once you've obtained this information, set your P4PORT environment variable to host:port#, where host is the name of the host that p4d is running on, and port# is the port that p4d is listening on. For example:

If the p4d host is named... and the p4d port is named... set P4PORT to:
  dogs

  3435

  dogs:3435

  x.com

  1818

  x.com:1818

The definition of P4PORT can be shortened if p4 is running on the same host as p4d. In this case, only the p4d port number need be provided to p4. And 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 p4d host is named... and the p4d port is... set P4PORT to...
<same host as the p4 client>

  9783

  9783

  perforce

  1666

<no value needed>

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


Perforce 98.2 p4 User's Guide
<< Previous Chapter
Concepts
Table of Contents
Index
Perforce on the Web
Next Chapter >>
Perforce 98.2 :Quick Start: Basics
Please send comments and questions about this manual to [email protected].
Copyright 1997, 1998 Perforce Software. All rights reserved.
Last updated: 08/08/98