
Search method
Starts searching for other peers.
Type
Integer.Syntax
- C++
int Search(char *peerNames, char *password, bool forever);
The Search(peerNames,password,forever) syntax has these parts:
The Search(peerNames,password,forever) syntax has these parts:
peerNames | String. (Wildcard) list of accepted peer names that can connect. |
password | String. Password to encrypt data with remote peer. |
forever | Boolean. When set to True, search for other peers will not end after first match is found. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Remarks
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.
Platforms
WindowsMac OSX
Linux
BSD
iPhone IOS