|
发表于 2009-7-12 22:18:12
|
显示全部楼层
Each networked application service class in the ACE Proactor framework derives from ACE_Service_Handler. Its key methods are shown in the following table:
Method
Description
open()
Hook method called to initialize the service after establishing a new connection
addresses()
Hook method to capture the local and remote addresses for the service connection
As mentioned above, ACE_Asynch_Acceptor and ACE_Asynch_Connector both call the ACE_Service_Handler::open() hook method for each new connection established. The handle argument is the handle for the connected socket. The ACE_Message_Block argument may contain data from the peer if the bytes_to_read parameter to ACE_Asynch_Acceptor::open() was greater than 0. Since this Windows-specific facility is often used with non-IP protocols (e.g., X.25), we don't discuss its use here. The ACE Proactor framework manages the ACE_Message_Block, so the service need not be concerned with it.
If the service handler requires either the local or peer addresses on the new connection, it must implement the addresses() hook method to capture them when the connection is established. The ACE Proactor framework calls this method if the pass_address argument to the asynchronous connection factory was 1. This method is more significant on Windows because the connection addresses cannot be obtained any other way when asynchronous connection establishment is used. |
|