C# Class Brunet.Messaging.IPHandler

IPHandler is provided to do BrunetRpc natively (as opposed to XmlRpc). This service provides for discovery similar to zeroconf. This was done due to zeroconf not being widespread enough to rely on it as well as too many ways to interface with the different implementations. Discovery runs at group address 224.123.123.222:56123.
Inheritance: SimpleSource
Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Méthodes publiques

Свойство Type Description
MagicCookie Brunet.Util.MemBlock
mc_addr System.Net.IPAddress
mc_endpoint System.Net.EndPoint
mc_port int

Protected Properties

Свойство Type Description
_listen_thread Thread
_mc Socket
_running int
_uc Socket

Méthodes publiques

Méthode Description
CreateMulticastSender ( ) : ISender

Creates a new MulticastSender using the IPHandlers multicastcast socket. This sends to all network devices on the computer.

CreateMulticastSender ( IPAddress LocalIPAddresses ) : ISender

Creates a Multicast Sender using the unicast socket, so that other nodes know where they can reach us. Only sends to the addresses in the array.

CreateUnicastSender ( EndPoint ep ) : ISender

Creates a new UnicastSender using the IPHandlers unicast socket.

GetLocalIPAddresses ( ) : System.Net.IPAddress[]

Returns an array of all the IPAddresses of the local machine. Manually add loopback sense Windows does not have a loopback interface.

IPAddressToInt ( IPAddress addr ) : int

IPAddress.Address is obsolete, we use our own method to convert to an int in case the method is removed.

IPHandler ( ) : System

Creates a new IPHandler object by initializing the multicast and unicast socket.

The multicast socket is optional as nodes can discover other working nodes using only the unicast socket. The steps for setup for a multicast socket are bind to 0.0.0.0:port, add membership to all IP Addresses on the node, allow MulticastLoopback. The steps for the unicast socket are to create socket andbind to 0.0.0.0 and random port. Afterwhich the _listen_thread is started in the background.

Stop ( ) : void

Called to interrupt the _listen_thread.

Méthodes protégées

Méthode Description
Listen ( ) : void

The _listen_threads method, reads from sockets and let's the node handle the incoming data.

Method Details

CreateMulticastSender() public méthode

Creates a new MulticastSender using the IPHandlers multicastcast socket. This sends to all network devices on the computer.
public CreateMulticastSender ( ) : ISender
Résultat ISender

CreateMulticastSender() public méthode

Creates a Multicast Sender using the unicast socket, so that other nodes know where they can reach us. Only sends to the addresses in the array.
public CreateMulticastSender ( IPAddress LocalIPAddresses ) : ISender
LocalIPAddresses System.Net.IPAddress The local ip addresses we should send on.
Résultat ISender

CreateUnicastSender() public méthode

Creates a new UnicastSender using the IPHandlers unicast socket.
public CreateUnicastSender ( EndPoint ep ) : ISender
ep System.Net.EndPoint The remote network end point where the UnicastSender should send the data.
Résultat ISender

GetLocalIPAddresses() public static méthode

Returns an array of all the IPAddresses of the local machine. Manually add loopback sense Windows does not have a loopback interface.
public static GetLocalIPAddresses ( ) : System.Net.IPAddress[]
Résultat System.Net.IPAddress[]

IPAddressToInt() public static méthode

IPAddress.Address is obsolete, we use our own method to convert to an int in case the method is removed.
When not an IPv4 address.
public static IPAddressToInt ( IPAddress addr ) : int
addr System.Net.IPAddress The address to convert to an integer.
Résultat int

IPHandler() public méthode

Creates a new IPHandler object by initializing the multicast and unicast socket.
The multicast socket is optional as nodes can discover other working nodes using only the unicast socket. The steps for setup for a multicast socket are bind to 0.0.0.0:port, add membership to all IP Addresses on the node, allow MulticastLoopback. The steps for the unicast socket are to create socket andbind to 0.0.0.0 and random port. Afterwhich the _listen_thread is started in the background.
public IPHandler ( ) : System
Résultat System

Listen() protected méthode

The _listen_threads method, reads from sockets and let's the node handle the incoming data.
protected Listen ( ) : void
Résultat void

Stop() public méthode

Called to interrupt the _listen_thread.
public Stop ( ) : void
Résultat void

Property Details

MagicCookie public_oe static_oe property

public static MemBlock,Brunet.Util MagicCookie
Résultat Brunet.Util.MemBlock

_listen_thread protected_oe property

Thread dedicated to reading from the unicast and multicast sockets
protected Thread _listen_thread
Résultat Thread

_mc protected_oe property

Runs on 224.123.123.222:56123
protected Socket _mc
Résultat Socket

_running protected_oe property

The system is running and so should _listen_thread.
protected int _running
Résultat int

_uc protected_oe property

The unicast socket, the port is randomly selected.
protected Socket _uc
Résultat Socket

mc_addr public_oe static_oe property

Multicast address.
public static IPAddress,System.Net mc_addr
Résultat System.Net.IPAddress

mc_endpoint public_oe static_oe property

Multicast end point.
public static EndPoint,System.Net mc_endpoint
Résultat System.Net.EndPoint

mc_port public_oe static_oe property

Multicast port.
public static int mc_port
Résultat int