readhandler.h

来自「ace开发环境 用来开发网络程序 其运用了设计模式、多平台、C++等多种知识」· C头文件 代码 · 共 93 行

H
93
字号
/* * ACE reactor demonstration * * $Id: ReadHandler.h 71193 2006-02-23 09:13:21Z jwillemsen $ * Date: 26-Jan-2006 */#ifndef __READHANDLER_H__#define __READHANDLER_H__#include <ace/Event_Handler.h>#include <ace/SOCK_Stream.h>/** * This read handler is created by the accept handler and handles all the data * exchange between client and server. The client makes two requests to the * server. The first asks the server to create a buffer which will hold the * data sent in the second call. */class ReadHandler : public ACE_Event_Handler {    private:        /**         * The stream socket used for data exchange.         */        ACE_SOCK_Stream mStream;        /**         * The size of the data array.         */        int mDataSize;        /**         * The array containing the client's data.         */        char *mData;        /**         * The call counter to distinguish between first and second call.         */        int mCallCounter;        /**         * Count the numer of invocations of handle_*(). According to the         * docs, there should be only one invocation at any given time.         */        int mInvocationCounter;    public:        /**         * Initialization.         */        ReadHandler(void);        /**         * Clean up data.         */        virtual ~ReadHandler();        /**         * Provide access to the internal stream socket.         */        ACE_SOCK_Stream &getStream(void);        /**         * @name Overridden methods from the ACE_Event_Handler         */        // @{        /**         * Provides the handle of mStream;         */        virtual ACE_HANDLE get_handle(void) const;        /**         * Handles the data excahnge between client and server. On the first         * invocation, mData is allocated to the requested size and on the         * second invocation, that buffer is filled with the client's data.         */        virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE);        /**         * Deletes this instance of the read handler.         */        virtual int handle_close(ACE_HANDLE, ACE_Reactor_Mask);        // @}};#endif /* __READHANDLER_H__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?