Here are three ways you might use the connectd daemon as a P2P initiator:
- Using explicit command line parameters in foreground mode
- Using explicit command line parameters in background mode
- Using a provisioning file in background mode.
Background vs. foreground mode
If you are using the P2P connection for an application that does not require the use of the command line (e.g. a web browser), then you may run connectd in the foreground (also called interactive mode). When you are done, you can simply type CTRL-C to terminate the connectd daemon. Foreground mode is demonstrated in option 1 on the following pages.
Foreground mode is useful for debugging if you have any problems initiating a P2P connection as it will show you connection status if you use the "-s" option.
The examples supplied for options 2 and 3 use "&" at the end of the connectd command line to force the connectd daemon to run in the background. This allows you to continue to use the same command prompt for an SSH connection, for example.
If you are developing your own apps including P2P mode, you'll need to keep track of the process ID (PID) so that you can kill the connectd daemon when you are done using the P2P connection. Examples 2 and 3 on the following pages show two different ways this can be done.