C# Class Org.Mentalis.Proxy.Listener

Specifies the basic methods and properties of a Listener object. This is an abstract class and must be inherited.
The Listener class provides an abstract base class that represents a listening socket of the proxy server. Descendant classes further specify the protocol that is used between those two connections.
Inheritance: IDisposable
Afficher le fichier Open project: mcorrientes/Web-Security-Toolset Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void

Disposes of the resources (other than memory) used by the Listener.

Stops listening and disposes all the client objects. Once disposed, this object should not be used anymore.

GetClientAt ( int Index ) : Client

Returns the requested client from the client list.

If the specified index is invalid, the GetClientAt method returns null.

GetClientCount ( ) : int

Returns the number of clients in the client list.

GetLocalExternalIP ( ) : IPAddress

Returns an external IP address of this computer, if present.

If this computer does not have any configured IP address, this method returns the IP address 0.0.0.0.

GetLocalInternalIP ( ) : IPAddress

Returns an internal IP address of this computer, if present.

If this computer does not have any configured IP address, this method returns the IP address 0.0.0.0.

Listener ( int Port, IPAddress Address ) : System

Initializes a new instance of the Listener class.

For the security of your server, try to avoid to listen on every network card (IPAddress.Any). Listening on a local IP address is usually sufficient and much more secure.

OnAccept ( IAsyncResult ar ) : void

Called when there's an incoming client connection waiting to be accepted.

Start ( ) : void

Starts listening on the selected IP address and port.

ToString ( ) : string

Returns a string representation of this object.

Méthodes protégées

Méthode Description
AddClient ( Client client ) : void

Adds the specified Client to the client list.

A client will never be added twice to the list.

IsLocalIP ( IPAddress IP ) : bool

Checks whether the specified IP address is a local IP address or not.

IsRemoteIP ( IPAddress IP ) : bool

Checks whether the specified IP address is a remote IP address or not.

RemoveClient ( Client client ) : void

Removes the specified Client from the client list.

Restart ( ) : void

Restarts listening on the selected IP address and port.

This method is automatically called when the listening port or the listening IP address are changed.

Method Details

AddClient() protected méthode

Adds the specified Client to the client list.
A client will never be added twice to the list.
protected AddClient ( Client client ) : void
client Client The client to add to the client list.
Résultat void

Dispose() public méthode

Disposes of the resources (other than memory) used by the Listener.
Stops listening and disposes all the client objects. Once disposed, this object should not be used anymore.
public Dispose ( ) : void
Résultat void

GetClientAt() public méthode

Returns the requested client from the client list.
If the specified index is invalid, the GetClientAt method returns null.
public GetClientAt ( int Index ) : Client
Index int The index of the requested client.
Résultat Client

GetClientCount() public méthode

Returns the number of clients in the client list.
public GetClientCount ( ) : int
Résultat int

GetLocalExternalIP() public static méthode

Returns an external IP address of this computer, if present.
If this computer does not have any configured IP address, this method returns the IP address 0.0.0.0.
public static GetLocalExternalIP ( ) : IPAddress
Résultat System.Net.IPAddress

GetLocalInternalIP() public static méthode

Returns an internal IP address of this computer, if present.
If this computer does not have any configured IP address, this method returns the IP address 0.0.0.0.
public static GetLocalInternalIP ( ) : IPAddress
Résultat System.Net.IPAddress

IsLocalIP() protected static méthode

Checks whether the specified IP address is a local IP address or not.
protected static IsLocalIP ( IPAddress IP ) : bool
IP System.Net.IPAddress The IP address to check.
Résultat bool

IsRemoteIP() protected static méthode

Checks whether the specified IP address is a remote IP address or not.
protected static IsRemoteIP ( IPAddress IP ) : bool
IP System.Net.IPAddress The IP address to check.
Résultat bool

Listener() public méthode

Initializes a new instance of the Listener class.
For the security of your server, try to avoid to listen on every network card (IPAddress.Any). Listening on a local IP address is usually sufficient and much more secure.
public Listener ( int Port, IPAddress Address ) : System
Port int The port to listen on.
Address System.Net.IPAddress The address to listen on. You can specify IPAddress.Any to listen on all installed network cards.
Résultat System

OnAccept() public abstract méthode

Called when there's an incoming client connection waiting to be accepted.
public abstract OnAccept ( IAsyncResult ar ) : void
ar IAsyncResult The result of the asynchronous operation.
Résultat void

RemoveClient() protected méthode

Removes the specified Client from the client list.
protected RemoveClient ( Client client ) : void
client Client The client to remove from the client list.
Résultat void

Restart() protected méthode

Restarts listening on the selected IP address and port.
This method is automatically called when the listening port or the listening IP address are changed.
There was an error while creating the listening socket.
protected Restart ( ) : void
Résultat void

Start() public méthode

Starts listening on the selected IP address and port.
There was an error while creating the listening socket.
public Start ( ) : void
Résultat void

ToString() public abstract méthode

Returns a string representation of this object.
public abstract ToString ( ) : string
Résultat string