C# Class Snarf.Udp.UdpListener

A basic listener that listens for incoming UDP messages on the specified port and passes the event on to application code whenever a message is received.
Inheritance: IDisposable
Afficher le fichier Open project: shellscape/Snarf Class Usage Examples

Protected Properties

Свойство Type Description
localMessagesOnly bool
port int
udp System.Net.Sockets.UdpClient

Méthodes publiques

Méthode Description
Dispose ( ) : void
GetLocalSubnetMask ( IPAddress ipaddress ) : IPAddress
GetNetworkAddress ( IPAddress address, IPAddress subnetMask ) : IPAddress
IsInSameSubnet ( IPAddress localAddress, IPAddress otherAddress ) : bool
Start ( ) : void
Start ( AsyncCallback callback ) : void

Starts listening for messages on the specified port

Stop ( ) : void

Stops listening for messages and frees the port

UdpListener ( int port, bool localMessagesOnly ) : System

Creates a new UdpListener

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Private Methods

Méthode Description
ProcessPacket ( IAsyncResult ar ) : void

When a message is received by the listener, the raw data is read from the packet and the PacketReceived event is fired.

Method Details

Dispose() public méthode

public Dispose ( ) : void
Résultat void

Dispose() protected méthode

protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

GetLocalSubnetMask() public static méthode

public static GetLocalSubnetMask ( IPAddress ipaddress ) : IPAddress
ipaddress System.Net.IPAddress
Résultat System.Net.IPAddress

GetNetworkAddress() public static méthode

public static GetNetworkAddress ( IPAddress address, IPAddress subnetMask ) : IPAddress
address System.Net.IPAddress
subnetMask System.Net.IPAddress
Résultat System.Net.IPAddress

IsInSameSubnet() public static méthode

public static IsInSameSubnet ( IPAddress localAddress, IPAddress otherAddress ) : bool
localAddress System.Net.IPAddress
otherAddress System.Net.IPAddress
Résultat bool

Start() public méthode

public Start ( ) : void
Résultat void

Start() public méthode

Starts listening for messages on the specified port
public Start ( AsyncCallback callback ) : void
callback AsyncCallback
Résultat void

Stop() public méthode

Stops listening for messages and frees the port
public Stop ( ) : void
Résultat void

UdpListener() public méthode

Creates a new UdpListener
public UdpListener ( int port, bool localMessagesOnly ) : System
port int The port to listen for messages on
localMessagesOnly bool true to only listen for messages from the local machine;false to listen for messages from any source
Résultat System

Property Details

localMessagesOnly protected_oe property

Indicates if messages from remote machines should be allowed or not
protected bool localMessagesOnly
Résultat bool

port protected_oe property

The port to listen for messages on
protected int port
Résultat int

udp protected_oe property

The underlying UdpClient
protected UdpClient,System.Net.Sockets udp
Résultat System.Net.Sockets.UdpClient