
Search method
Searches for remote peer using mediator.
Type
Integer.Syntax
- C#
- C++
- VB.NET
int devP2P.Search(IntPtr Handle, string customdata);
The Search(Handle,customdata) syntax has these parts:
The Search(Handle,customdata) syntax has these parts:
Handle | Reference to the devP2P instance. |
customdata | String buffer to send to remote peer. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
int Search(char *customdata);
The Search(customdata) syntax has these parts:
The Search(customdata) syntax has these parts:
customdata | NULL terminated buffer to send to remote peer. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Function P2P_Search(ByVal Handle As IntPtr, ByVal customdata As String) As Integer
The Search(Handle,customdata) syntax has these parts:
The Search(Handle,customdata) syntax has these parts:
Handle | Reference to the devP2P instance. |
customdata | String buffer to send to remote peer. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Remarks
Before calling Search method, make sure you set peer related properties MyName and PeerName, so devP2P knows who to search for. Also, make sure you have set MediatorAddress and MediatorPort so we have a place to send search request to.Search method is used to locate remote peers whose IP/Port is not known, and needs be be located. Usually, the "man in the middle", who is publicly available, is needed so both peers can announce their presence to the mediator. When mediator finds a match, he replies to both peers with other peer's details, and finishes communication. Mediator is NOT used to relay the data, unless specifically setup to do so.
When search completes, SearchDone event will be fired with search results, being successful or not. If successful, then you will receive information about remote peer's possible IP/Port combinations where connection can be attempted.
You can use customdata to send to remote peer, which can be used by remote before he attempts to Link with you.
Platforms
WindowsMac OSX
Linux
BSD