C# Класс 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.
Наследование: SimpleSource
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
MagicCookie Brunet.Util.MemBlock
mc_addr System.Net.IPAddress
mc_endpoint System.Net.EndPoint
mc_port int

Защищенные свойства (Protected)

Свойство Тип Описание
_listen_thread Thread
_mc Socket
_running int
_uc Socket

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
Listen ( ) : void

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

Описание методов

CreateMulticastSender() публичный Метод

Creates a new MulticastSender using the IPHandlers multicastcast socket. This sends to all network devices on the computer.
public CreateMulticastSender ( ) : ISender
Результат ISender

CreateMulticastSender() публичный Метод

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.
Результат ISender

CreateUnicastSender() публичный Метод

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.
Результат ISender

GetLocalIPAddresses() публичный статический Метод

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[]
Результат System.Net.IPAddress[]

IPAddressToInt() публичный статический Метод

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.
Результат int

IPHandler() публичный Метод

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
Результат System

Listen() защищенный Метод

The _listen_threads method, reads from sockets and let's the node handle the incoming data.
protected Listen ( ) : void
Результат void

Stop() публичный Метод

Called to interrupt the _listen_thread.
public Stop ( ) : void
Результат void

Описание свойств

MagicCookie публичное статическое свойство

public static MemBlock,Brunet.Util MagicCookie
Результат Brunet.Util.MemBlock

_listen_thread защищенное свойство

Thread dedicated to reading from the unicast and multicast sockets
protected Thread _listen_thread
Результат Thread

_mc защищенное свойство

Runs on 224.123.123.222:56123
protected Socket _mc
Результат Socket

_running защищенное свойство

The system is running and so should _listen_thread.
protected int _running
Результат int

_uc защищенное свойство

The unicast socket, the port is randomly selected.
protected Socket _uc
Результат Socket

mc_addr публичное статическое свойство

Multicast address.
public static IPAddress,System.Net mc_addr
Результат System.Net.IPAddress

mc_endpoint публичное статическое свойство

Multicast end point.
public static EndPoint,System.Net mc_endpoint
Результат System.Net.EndPoint

mc_port публичное статическое свойство

Multicast port.
public static int mc_port
Результат int