C# Class NetworkCommsDotNet.Tools.PeerDiscovery

Provides the ability to discover 'discoverable' peers on the local network.
ファイルを表示 Open project: MarcFletcher/NetworkComms.Net

Public Methods

Method Description
DisableDiscoverable ( ) : void

Disable this peers discoverable status for all discovery methods.

DisableDiscoverable ( DiscoveryMethod discoveryMethod ) : void

Disable this peers discoverable status for the provided DiscoveryMethod.

DiscoverPeers ( DiscoveryMethod discoveryMethod ) : Dictionary>>

Discover local peers using the provided DiscoveryMethod and default discover time. Returns dictionary keyed on peer network identifier. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.

DiscoverPeers ( DiscoveryMethod discoveryMethod, int discoverTimeMS ) : Dictionary>>

Discover local peers using the provided DiscoveryMethod. Returns dictionary keyed on peer network identifier. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.

DiscoverPeersAsync ( DiscoveryMethod discoveryMethod ) : void

Discover local peers using the provided DiscoveryMethod asynchronously. Makes a single async request for peers to announce. Ensure that you append to the OnPeerDiscovered event to handle discovered peers. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.

EnableDiscoverable ( DiscoveryMethod discoveryMethod ) : void

Make this peer discoverable using the provided DiscoveryMethod. Uses all suitable and allowed adaptors, e.g. for IP networks uses HostInfo.IP.FilteredLocalAddresses(). IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.

EnableDiscoverable ( DiscoveryMethod discoveryMethod, EndPoint localDiscoveryEndPoint ) : void

Make this peer discoverable using the provided DiscoveryMethod. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.

IsDiscoverable ( DiscoveryMethod discoveryMethod ) : bool

Returns true if local discovery endPoints exist for the provided DiscoveryMethod.

LocalDiscoveryEndPoints ( ) : List>.Dictionary

Returns the local endpoints that are currently used to make this peer discoverable.

LocalDiscoveryEndPoints ( DiscoveryMethod discoveryMethod ) : List

Returns the local endpoints that are currently used to make this peer discoverable using the provided DiscoveryMethod.

Private Methods

Method Description
DeserializeRemoteListenerList ( byte data, ShortGuid &networkIdentifier ) : List

Deserializes remote listeners that are discoverable

DiscoverPeersBT ( int discoverTimeout ) : Dictionary>>

Discover peers using BT SDP

DiscoverPeersTCP ( int discoverTimeMS ) : Dictionary>>

Discover peers using TCP port scan

DiscoverPeersUDP ( int discoverTimeMS ) : Dictionary>>

Discover peers using UDP broadcast

PeerDiscovery ( ) : System
PeerDiscoveryHandler ( PacketHeader header, Connection connection, byte data ) : void

Handle the incoming peer discovery packet

SerializeLocalListenerList ( ) : byte[]

Serializes the local listeners that are discoverable

Method Details

DisableDiscoverable() public static method

Disable this peers discoverable status for all discovery methods.
public static DisableDiscoverable ( ) : void
return void

DisableDiscoverable() public static method

Disable this peers discoverable status for the provided DiscoveryMethod.
public static DisableDiscoverable ( DiscoveryMethod discoveryMethod ) : void
discoveryMethod DiscoveryMethod The to disable discovery for.
return void

DiscoverPeers() public static method

Discover local peers using the provided DiscoveryMethod and default discover time. Returns dictionary keyed on peer network identifier. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.
public static DiscoverPeers ( DiscoveryMethod discoveryMethod ) : Dictionary>>
discoveryMethod DiscoveryMethod The to use for discovering peers.
return Dictionary>>

DiscoverPeers() public static method

Discover local peers using the provided DiscoveryMethod. Returns dictionary keyed on peer network identifier. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.
public static DiscoverPeers ( DiscoveryMethod discoveryMethod, int discoverTimeMS ) : Dictionary>>
discoveryMethod DiscoveryMethod The to use for discovering peers.
discoverTimeMS int The wait time, after all requests have been made, in milliseconds before all discovered peers are returned.
return Dictionary>>

DiscoverPeersAsync() public static method

Discover local peers using the provided DiscoveryMethod asynchronously. Makes a single async request for peers to announce. Ensure that you append to the OnPeerDiscovered event to handle discovered peers. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.
public static DiscoverPeersAsync ( DiscoveryMethod discoveryMethod ) : void
discoveryMethod DiscoveryMethod
return void

EnableDiscoverable() public static method

Make this peer discoverable using the provided DiscoveryMethod. Uses all suitable and allowed adaptors, e.g. for IP networks uses HostInfo.IP.FilteredLocalAddresses(). IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.
public static EnableDiscoverable ( DiscoveryMethod discoveryMethod ) : void
discoveryMethod DiscoveryMethod
return void

EnableDiscoverable() public static method

Make this peer discoverable using the provided DiscoveryMethod. IMPORTANT NOTE: For IP networks we strongly recommend using the UDP broadcast discovery method.
public static EnableDiscoverable ( DiscoveryMethod discoveryMethod, EndPoint localDiscoveryEndPoint ) : void
discoveryMethod DiscoveryMethod The discovery method for which this peer should be discoverable
localDiscoveryEndPoint EndPoint The local endpoint with which to make this peer discoverable
return void

IsDiscoverable() public static method

Returns true if local discovery endPoints exist for the provided DiscoveryMethod.
public static IsDiscoverable ( DiscoveryMethod discoveryMethod ) : bool
discoveryMethod DiscoveryMethod
return bool

LocalDiscoveryEndPoints() public static method

Returns the local endpoints that are currently used to make this peer discoverable.
public static LocalDiscoveryEndPoints ( ) : List>.Dictionary
return List>.Dictionary

LocalDiscoveryEndPoints() public static method

Returns the local endpoints that are currently used to make this peer discoverable using the provided DiscoveryMethod.
public static LocalDiscoveryEndPoints ( DiscoveryMethod discoveryMethod ) : List
discoveryMethod DiscoveryMethod
return List