Internet Direct (Indy)
Home
PreviousUpNext
TIdUDPServer Class

Implements a UDP server.

Pascal
TIdUDPServer = class(TIdUDPBase);

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

RFC 768 - User Datagram Protocol  

TIdUDPServer uses an instance of TIdUDPListenerThread to perform read operations for one or more socket bindings used by the server. The listener thread adds each socket handle in Bindings to the the read list for the server. 

Accessing a binding in the server ensures that socket bindings have a handle allocated, and that the value in BroadcastEnabled is applied for each binding. Set the value in BroadcastEnabled (prior to starting the server) to indicate if the server can receive broadcast datagram packets. 

If none of the socket bindings for the server are currently active, the initial instance in Bindings is selected and the listener thread is started. This behavior is also exhibited when the value in Active changes from False to True. 

Set the value in DefaultPort (prior to starting the server) to indicate the port number used to listen for datagram packets in the listener thread for the server. 

When a datagram is received from a client connection, the incoming data is read from the protocol stack using the server Binding and the OnUDPRead event handler. Receipt of data packets can be synchronized to the main VCL thread by using the ThreadedEvent property. 

TIdUDPServer reimplements some of the private and protected methods from the ancestor class to accommodate use of one or more socket bindings available in the server. 

In TIdUDPServer, changing the value in Active to False forces the server to stop the listener thread that accepts datagrams from client connections, and to close the socket connection for each of the instances in Bindings

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.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.