Indy 9 | Content | Index | Reference

TIdUDPServer
Hierarchy, Properties, Methods, Events, See Also, Unit: IdUDPServer
Implements a UDP server.

    TIdUDPServer = class(TIdUDPBase)

Unit
IdUDPServer
Description
TIdUDPServer is a TIdUDPBase descendant that is a server implementation of the User Datagram Protocol(UDP) as described in the Internet standards document:

- RFC 768 - User Datagram Protocol (http://www.rfc-editor.org/rfc/rfc768.txt)

TIdUDPServer uses an instance of TIdUDPListener to perform read operations for multiple socket bindings created by the server.

TIdUDPServer can be used as an ancestor class for other server components based on the User Datagram Protocol. TIdTrivialFTPServer is a descendant of the TIdUDPServer component.

TIdUDPServer.Bindings
TIdUDPServer, See Also
Socket handles allocated by the server.

    property Bindings: TIdSocketHandles;

Description
Bindings is a TIdSocketHandles property and a collection of TIdSocketHandle instances. For TIdUDPServer, Bindings will contain TIdSocketHandles instances with an allocated socket of type ID_SOCK_DGRAM.

Bindings provides the DefaultPort number for the TIdUDPServer and is used by the TIdUDPListenerThread to gain access to the socket handle and low-level access methods provided by the protocol stack.

TIdUDPServer.DefaultPort
TIdUDPServer, See Also
Port number used to listen for new connections.

    property DefaultPort: integer;

Description
DefaultPort is an Integer property that identifies the port number used for new socket bindings created by the server. The value of DefaultPort is read from and written to Bindings.DefaultPort.

TIdUDPServer uses the DefaultPort number to bind the allocated datagram socket handle when the Active property to set to True.

TIdUDPServer.ThreadedEvent
TIdUDPServer, See Also
Indicates the method used for UDP read events.

    property ThreadedEvent: boolean;

Description
ThreadedEvent is a Boolean property that indicates if the UDP server is using a seperate thread to perform reads for the UDP connection, or if reads must be synchronised using a UDP method.

When ThreadedEvent is True, the TIdUDPListenerThread.UDPRead method is used to handle read operations. The default value for ThreadedEvent is False.

TIdUDPServer.Create
TIdUDPServer
Constructor for the object instance.

    constructor Create(axOwner: TComponent); override;

Description
Create is the constructor for the TIdUDPServer object instance. Create uses the inherited Create method to initialize the object instance, and creates the default TIdSocketHandle instance in Bindings for the server.

Note: The Host and DefaultPort properties must set to the desired values before the UDP server can be activated.

TIdUDPServer.Destroy
TIdUDPServer
Destructor for the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for TIdUDPServer, and is responsible for disposing of the TIdUDPServer object instance. Destroy performs the following actions:

- Set Active to False.

- Frees the TIdSocketHandles in Bindings.

- Calls the inherited Destroy method.

Destroy should not be directly called in an application. Use Free instead. Free checks to ensure that the object reference is not Nil before calling Destroy.

Note: If an exception is emitted from the constructor, the destructor is called to destroy the partially constructed object instance. Destructors should check that allocated resources, such as handles, were actually allocated before trying to release them.

TIdUDPServer.OnUDPRead
TIdUDPServer, See Also
Event handler for UDP read events.

    property OnUDPRead: TUDPReadEvent;

Parameters
ABinding
Socket binding receiving the UDP datagram.
AData
Stream containing data in the UDP datagram.
Description
OnUDPRead is an event handler for TUDPReadEvent events. OnUDPRead is triggered by the DoUDPRead method when data has been read from the socket binding and is available for use by the server.

Assign a TUDPReadEvent handler procedure to OnUDPRead to respond to the event.

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