[Top] [Prev] [Next]

Connecting to the
p4d 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.

Two programs do the bulk of Perforce's work:

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.

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.

Verifying the Connection to
the p4d Server

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

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.

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.

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.

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.



[Top] [Prev] [Next]

Command Line User's Guide for PERFORCE
Copyright 1997 Perforce Software. Comments to [email protected].
Last updated: November 20, 1997