sesselect.h

来自「在LINUX环境下」· C头文件 代码 · 共 66 行

H
66
字号
/******************************************************************************
 *         $Header:
 *
 *
 *         (c) Copyright 2006 by SCADA Enterprise Solutions Inc
 *         All rights reserved
 *
 * NAME:
 *
 *         sesSelect.H -- This is the header file for the sesSelect class
 *                        This object is simplifies the usage of select
 *                        statement
 *
 * AUTHOR: Wai Tse
 *
 * DESCRIPTION:
 *
 *         This class provides a C++ select on socket services
 *
 * REVISION HISTORY:
 *
 *         Initial creation on Feb 19, 2006
 * 
 *****************************************************************************/

#ifndef SES_SELECT_H
#define SES_SELECT_H

#include <errno.h>
#include "sesConst.H"
#include "sesDbg.H"
#include "sesLogErr.H"

#define TIMEOUT_SEC 15          // timeout for waiting message in second
#define TIMEOUT_USEC 0          // timeout for waiting message in micro-second
#define NON_BLOCKING 0          // no blocking on select
#define BLOCK 1                 // block until data arrives at one socket

class sesSelect
{
public:
                            sesSelect   ();
                            sesSelect   (const int);
                            sesSelect   (const int,
					 const int);
                            ~sesSelect  ();
           void             setTimeout  (const int);
           int              ready       (const int);
           int              isSet       (const int);
           void             add         (const int);
           void             remove      (const int);
           int              getHighSock (const int);
private:

           char     _tmpMsg[MAX_LEN_MSG];    // temporary message buffer
           struct timeval     _timeout,      // timeout for select statement
                              _savedTimeout; // saved timeout
           fd_set             _savedMask;    // a copy file descriptor mask
           fd_set             _readMask;     // File descriptor mask for select
           int                _numFds,       // number of sockets with data
	                      _numFdsMon;    // number of sockets monitored

};

#endif // SES_SELECT_H

⌨️ 快捷键说明

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