Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.1

# Work over unreliable networks

## Limit network waiting time

To set a hard limit on the number of seconds a connection waits on any single network read or write before disconnecting with a network error:

- add a line for `net.maxwait` value in the client's P4CONFIG file. For example,
  `net.maxwait=60`

  or

- use `-vnet.maxwait=`t`` on a per-command basis, where `t` is the number of seconds to wait before timing out. For example,
  `p4 -vnet.maxwait=60 submit -c changenum`

We recommend that you do NOT set `net.maxwait` on the P4 Server because it can cause commands to time out unnecessarily. For example, if `net.maxwait` is set to `60` on the server, users of the Command-Line Client must complete every interactive form within 60 seconds.

## Reconnection attempts

It is useful to combine `net.maxwait` with the `-rN` global option, where `N` is the number of times to attempt reconnection if the network times out. For example:

    $ p4 -r3 -vnet.maxwait=60 sync

attempts to resume an interrupted sync up to three times before failing.

### Avoid -r when reading from standard input

Avoid the use of `-r` on any command that reads from standard input, such as `$ find . -print | p4 -x - -r3 add`

If such a command times out and is restarted, the result could be a filename that is incomplete.

### A safer approach

If you are adding a large number of files over an unreliable connection, consider a file by file approach:

    $ find directoryname -type f -exec p4 -r5 -vnet.maxwait=60 add {} \;

This finds all the files (`-type f`) in `directoryname`, and adds each one by invoking "`p4 -r5 -vnet.maxwait=60 add`" for each file individually.

After all files have been added, assign the changelist a changelist number with p4 change, and submit the numbered changelist atomically with

    $ p4 -r5 -vnet.maxwait=60 submit -c changenum

If connectivity is interrupted, the `-r` value causes the submission to resume.

Your search for returned results