0

Can p4api.net connect to a (local) p4 personal server?

I started a personal server with

p4 -u itsame -d c:\perforce\local -c itsameClient clone -m 1 -v -p p4server:somePort -f //repo/path/...

It works - it can use it in p4v or from the command like - there's even the .p4root in c:\perforce\local.

However, from the latest p4api.net, it just keeps trying to use TCP to connect. Is there no way to say this is to the file system - or perhaps does the personal server expose itself to localhost:port somehow?

Matt
  • 25,943
  • 66
  • 198
  • 303
  • What `P4PORT` value are you using in your P4API.NET application? – Samwise Mar 07 '21 at 15:56
  • I just point it to the .p4root file on the file system.I assume that’s wrong, but I couldn’t find or see anything about a local tcp endpoint being instantiated. – Matt Mar 07 '21 at 16:41
  • Run `p4 set` at the command line in your local server to see what the `P4PORT` syntax is for connecting to a personal server and launching a p4d each time you run a command (`rsh:p4d...` or something like that). If you just set it to your P4ROOT folder, what's probably happening is that it's trying to do a DNS lookup on the string `.p4root` or whatever you gave it. – Samwise Mar 07 '21 at 19:57
  • You may also be able to just use the `.p4config` file that was set up as part of the `p4 clone` (rather than hardcoding P4PORT) if you set `cwd` correctly in your P4API application and don't override any of the other connection settings. – Samwise Mar 07 '21 at 20:00

1 Answers1

1

The client application's P4PORT needs to be set correctly in order to connect to a server. For a remote server you simply specify the hostname:port. For a personal server, there's a special P4PORT syntax that specifies how the local server executable is to be invoked to service client requests. You can see it by running p4 set P4PORT within your personal server directory:

C:\Perforce\test>p4 set P4PORT
P4PORT=rsh:p4d.exe -i -r "c:\Perforce\test\.p4root" (config 'c:\Perforce\test\p4config.txt')

Note that when you initialize a personal server, it automatically sets up P4CONFIG in that directory, which is why that P4PORT is automagically set for you already. Your P4API.NET application should be able to use that same config (removing the need to manually copy over the P4PORT string) as long as:

  • it has the correct cwd set (i.e. the directory the personal server lives in)
  • the P4PORT is not overridden with an incorrect value
Samwise
  • 68,105
  • 3
  • 30
  • 44