Indy 9 | Content | Index | Reference

TIdIPMCastListenerThread
Hierarchy, Properties, Methods, Events, Unit: IdIPMCastClient
Implements a listener thread for incoming multicast client connections.

    TIdIPMCastListenerThread = class(TIdThread)

Unit
IdIPMCastClient
Description
TIdIPMCastListenerThread is a TIdThread descendant that implements the mechanism used to listen for incoming datagram packets for an active TIdTIdIPMCastClient instance. TIdIPMCastListenerThread provides properties and methods that allow the listener thread to be executed in order to accept incoming connections, read and buffer the incoming datagram packets, and optionally signal the associated multicast client of the operation.

TIdIPMCastListenerThread.AcceptWait
TIdIPMCastListenerThread, See Also
Indicates the number of milliseconds to wait for selection of socket descriptors.

    property AcceptWait: integer;

Description
AcceptWait is an Integer property that indicates the number of milliseconds that the executing listener thread should wait for selection of socket descriptors used to read incoming datagrams for the multicast client. The default value for AcceptWait is 1000, as assigned in the Create constructor.

TIdIPMCastListenerThread.Create
TIdIPMCastListenerThread, See Also
Constructor for the object instance.

    constructor Create(Owner: TIdIPMCastClient); reintroduce;

Parameters
Owner: TIdIPMCastClient
Multicast client that owns the listening thread.
Description
Create is the constructor for the object instance. Create calls the inherited Create method to instantiate a suspended thread. The value in Owner is assigned to the public member that represents the server for the listener thread, and BufferSize is set to the corresponding property value in Owner. Create sets the default value for AcceptWait to 1000. Create also allocates resources used for the Buffer property.

TIdIPMCastListenerThread.Destroy
TIdIPMCastListenerThread, See Also
Frees the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for the object instance. Destroy frees resource allocated to the Buffer property in the Create method prior to calling the inherited Destroy method.

TIdIPMCastListenerThread.IPMCastRead
TIdIPMCastListenerThread, See Also
Signals receipt of a datagram packet to the multicast client.

    procedure IPMCastRead;

Description
IPMCastRead is a procedure that allows the listener thread to signal receipt of a datagram packet to the multicast client. IPMCastRead uses the public member representing the client context to perform the protected method that signals the TIdIPMCastClient.OnIPMCastRead event handler.

TIdIPMCastListenerThread.Run
TIdIPMCastListenerThread, See Also
Starts execution of the listener thread for a multicast client.

    procedure Run; override;

Description
Run is an overridden procedure in TIdIPMCastListenerThread that starts execution of the listener thread for the associated multicast client. Run performs several significnt actions that affect operation of the multicast client.

Run creates a TList that is used to store references to the socket handles in TIdIPMCastClient.Bindings that are used to accept incoming datagrams for the multicast client. Run iterates over socket handles in the list to retrieve the socket descriptor and initalize the Buffer used for reading incoming datagram packets. Run can raise an EIdUDPReceiveErrorZeroBytes exception zero (0) bytes are read from a connection accepted by the listening thread.

Run also examines the TIdIPMCastClient.ThreadedEvent for the associated multicast client to determine if the IPMCastRead method can be triggered in the content of the multicast client, or if it must be synchronized to the main VCL thread.

Run clears and frees the TList used for socket handles prior to exiting from the method.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.