Back to product page

Search method

Starts searching for other peers.




  • C++
int Search(char *peerNames, char *password, bool forever);
The Search(peerNames,password,forever) syntax has these parts:
peerNamesString. (Wildcard) list of accepted peer names that can connect.
passwordString. Password to encrypt data with remote peer.
foreverBoolean. When set to True, search for other peers will not end after first match is found.
Return value0 (ErrorNone) if success, otherwise negative value from Errors enumeration.


Search method should be called after the Start method, to initiate searching for remote peers. You can search for specific peer, or for more than one peer, by setting peerNames to contain '*' at the end of the allowed names. This way you can create one-to-many VPN connection, and devVPN will create devP2P instances on the fly as new peers arrive.

If forever is set to True, devVPN will continue searching for new peers and added them to local collection as they arrive. This is typical usage for server kind of applications. If you're creating client side, it is suggested to set forever to False, and possibly if connection is broken after some time re-initiate searching again.

You can call Search method anytime you wish, to start your search for different peers. When doing so, previous Search will be cancelled, and new one will be invoked.


iPhone IOS