Using Stack Callbacks

 < Day Day Up > 



Rather than rely on blocking semantics for socket events (such as data available for read), alternatives exist that can provide higher performance. Numerous stacks provide the ability to install user-provided functions for the stack to call when events occur for a given socket. For example, a special user-receive function could be installed for a given socket that would be called when read data was available for the socket.

The greatest advantage to stack callbacks is the reduction of latency in receipt of data to its migration to the Application layer (as the callbacks exist with the application). After data is pushed from the Transport layer (TCP or UDP) to the Sockets layer, the callback is immediately called for the given socket and the data is then available at the Application layer. This can represent a huge performance boost.

Not all Sockets implementations provide callbacks, but when they do, they should be utilized for efficiency. An example stack that provides callback functionality is the Treck stack from Elmic Systems [Elmic].



 < Day Day Up > 



BSD Sockets Programming from a Multi-Language Perspective
Network Programming for Microsoft Windows , Second Edition (Microsoft Programming Series)
ISBN: 1584502681
EAN: 2147483647
Year: 2003
Pages: 225
Authors: Jim Ohlund

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net