PA Server – What and why?
When developing software for multiple platforms you often need to debug and run applications on machine and devices that are not your development PC. The RAD Studio and Appmethod approach to this is an ingenious little program that acts as a go-between from the IDE to the remote device / machine. Called PAServer (PA = Platform Assistant) allows the IDE to retrieve the full call stack at run time, pause code with break points, inspect values etc, exactly as you would do debugging a local application.
PA Server is often used on a Mac OS X target for running and debugging applications to Mac OS X, iOS Simulator and iOS Devices, however there is also a windows version of PAServer and this can also be used to simplify preparing for deployment.
PA Server runs over TCP/IP and while developers often use it for local network work, in theory there is no reason why you can not use it to remote debug that trouble some customer where you can’t quite recreate what they are doing. (as long as they are happy for you to install the PA Server client on their machine).
PA Server is also great for deploying files directly to a remote machine when used with the Deployment Options for the project. This ensures that all the files specified are pushed remotely. This is great for updating a remote server or internal build machines.
Installation of PAServer
PA Server needs to be installed on the machine you want to run applications on remotely The install files both Windows and Mac OS X are located in the PAServer folder under your Appmethod / RAD Studio / Delphi / C++ Builder installation. e.g. with RAD Studio XE7 they are located at C:\Program Files (x86)\Embarcadero\Studio\15.0\PAServer.
Both installers (Windows / Mac OS X) just require you to push the next button a few times to install the server.
Running PA Server remotely…
PA Server is ultimately a Console application that you launch, enter a session password (that remote developers will need to connect to the session) and leave running without having to go back to it, but this is how to launch it on each platform.
..on MAC OS X
To launch PAServer on a Mac you have two choices.
- Go to “Applications” and choose PAServer 15.0 (for XE7)
- Use the new GUI in LaunchPad called PAServer Manager
If you use PAServer Manager you will see the icon appear at the top of your screen in the menu bar. Clicking on this allows you to “Add Server” (I just call it MyMac by default) and then start and stop the services as well as other useful things like viewing the information (such as IP Address etc). A lot easier than remembering command codes.
PA Server Manager is also useful for managing groups of developers who want to run multiple instances of PA Server on the same machine when developing.
To launch PA Server on windows once installed, you need to browse to the PAServer folder (typically C:\Program Files (x86)\Embarcadero\PAServer\15.0) and double click on the PAServer application.
Connecting to PAServer running on a Windows machine from the IDE
With PA Server installed, opened and a password set for the session, it is possible to make the remote connection (or even a loopback for a more advanced local test). To achieve this we need to configure a profile for connecting to the remote PAServer instance. – this is really quick to do.
Firstly select the desired compilation target of Win32 or Win64 in the Project Manager, and then right click and choose properties. The platform properties window is then opened allowing you to choose a profile for the target.
By default you will need to choose “Add New…” under platforms the first time you run this step, subsequently you will already have the profile saved.
Following the wizard for Add New, you can enter a name (e.g. MyPC) and then the IP address (port 64211 should be default unless you have changed it during install). Once you have the IPAddress or pc name entered you can “Test Connection” to verify that the path is working correctly.
If this fails then check you IP Address is correct – if unsure type “i” into the PAServer console and hit enter to get a list of the listening IPAddresses and check your firewall.
Once you have selected the Platform Profile and its tested, all you need to do is hit run just like before. Rather than deploying to your project directory, deploying to PA Server sends out all the files into a the PAServer scratch directory (under Documents\PAServer) e.g. C:\Users\Steve\Documents\PAServer\15.0\scratch-dir\
Tip for making things simple?
If you have selected any feature files or added your own files under Deployment Options when developing your applications, e.g. enabling InterBase, IBLite or DBExpress etc. These files will be packaged up for you when running out to PAServer giving you a complete folder structure with files ready for packaging. This also makes testing locally a lot lot simpler 🙂
Getting back to normal
Once you are done testing against a remote profile you can easily return to running locally by right clicking on the target and choosing to Revert to Default Connection.