Option 3: Windows connectd P2P initiator using a provisioning file

The daemon connectd.exe allows the use of a provisioning, or configuration, file to allow better organization of multiple P2P connections. Here is a sample provisioning file for a P2P initiator.

Copy and save the sample provisioning file below to a file that corresponds to your target Service. For example, if the UID is for an ssh Service running on a Raspberry Pi, you could call this file SSH-Pi.txt, so you can remember which files correspond to which services.

Customize the provisioning file

Edit the following entries in the sample provisioning file to match your account and target device.

  • user_id : your remote.it account user name

  • auth_pass : your remote.it account password

  • remote_address : your target Service's UID

  • proxy_local_port : desired localhost port

# Sample Provisioning file
# user ID to use for the initiator connection (required)
user_id username@remote.it
# users authhash - use Powershell script getAuthhash.ps1
auth_hash 5FxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCF4
# local port to bind TCP proxy socket to, mandatory
proxy_local_port 33004
# proxy local IP to bind to, can be, or any local adapter IP
# remote_address is the (UID) address of the target to connect to.
remote_address 80:00:00:00:00:00:00:C2
# Maximum buffer depth for each TCP connection (35-40) raise for high latency environments
max_depth 35
# setting autoconnect to 1 will autoconnect the p2p initiator to the target
# setting autoconnect to 2 will attempt to automatically reconnect in the event 
# of a network interruption
autoconnect 1
# keep this comment line here


Download the attached p2p-file.zip to the same folder where you saved connectd.exe and SSH-Pi.txt.  Extract the Powershell script p2p-file.ps1.  p2p-file.ps1 is similar to p2p.ps1 in the previous example, except p2p-file.ps1 uses a provisioning file rather than placing all connection and account information on the connectd.exe command line.

Run the script

Start Powershell and run:

.\p2p-file.ps1 SSH-Pi.txt

The script will output connection information, then after about 10 seconds, you should see the following output:

Starting Proxy on port 33301 on index 1.
Proxy started.
Created a P2P connection...
To terminate this connection, enter:
Stop-Process 11376
PS C:\Users\test\Downloads\remot3.it\P2P>

Note the process ID (PID) for connectd.exe is displayed (here it is 11376). To kill the connectd process when you are done with the connection, run the following command:

Stop-Process 11376

Automatically maintain the P2P connection

You can set the autoconnect parameter value to 2 in the initiator provisioning file to have the daemon automatically attempt to reconnect to the target in the event of a network interruption.

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