Using connectd in P2P initiator mode in Windows

Download the connectd.exe daemon

The connectd daemon is used on your target device to create Services. The same daemon is used on the initiator side of a P2P connection, although in a different mode. The rest of this guide describes configuration of connectd on the initiator side.

The example below shows you how to download and run connectd.exe on your Windows machine. Open a command prompt, create a directory to keep P2P related files in, and cd to that directory; we will use a directory called P2P. Next, enter the commands as shown below. We are going to be using PowerShell for all commands in this example.

Start PowerShell

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Download connectd.exe

Copy and paste the line below to your PowerShell console. Press the Enter key to download the connectd.exe file.

wget -O connectd.exe

Run the connectd network test

To confirm that you have the correct connectd daemon, and that your network is configured correctly, run

.\connectd.exe -n

at the command line. You may have to configure any virus checker that you are using in order to allow connectd.exe to be run.

The output should be similar to the following:

PS C:\Users\test\Downloads\\P2P> .\connectd.exe -n
Connectd built Sep 29 2020 at 17:03:22 Now Starting Up
Version 4.9.0 - (c)2020, Inc. All Rights Reserved
Built with NATPMP BCASTER MALLOC_POOL pool=1048576
alloc pool

Running Network Diagnostics
Checking if DNS works ... .[OK]
Checking TCP connectivity to<oip=> [OK]
Checking UDP connectivity to
Send to [] [mip=] [oport=59612 mport=59612] [preserve port]
Send to [] [mip=] [oport=59612 mport=59612] [no remap] [preserve port]
Send to [] [mip=] [oport=59612 mport=59612] [no remap] [preserve port different IP] [OK]
Checking if NAT-PMP Router is found...[Pub IP][epoch 638472][FOUND]

This router preserves ports, this is optimal.
This router doesn't remap new connections to new ports.
NAT-PMP is enabled on this router, this is optimal
Static Pool Free
Endian : Little
SHA1 test:
RC4 test:
XXTEA test:
Looks compatible.
PS C:\Users\test\Downloads\\P2P>

Different ways to use connectd as a P2P initiator

On the following pages, we show 3 ways you might use the connectd.exe daemon as a P2P initiator.

  1. Using explicit command line parameters in foreground mode

  2. Using explicit command line parameters in background mode

  3. 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.exe 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.

The examples supplied for options 2 and 3 use the PowerShell "Start-Process" command 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 connectd.exe being run in background mode.

Was this article helpful?
0 out of 0 found this helpful