⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketsreader.h

📁 NOKIA手机的基于C++的socket完整的开发API,非常好用
💻 H
字号:
/* Copyright (c) 2001, Nokia Mobile Phones. All rights reserved */

#ifndef __SOCKETSREADER_H__
#define __SOCKETSREADER_H__

#include <in_sock.h>

class MEngineNotifier;

/*! 
  @class CSocketsReader
  
  @discussion This class handles reading data from the socket.
  In this implementation, any data read is simply displayed as text on the console.
  */
class CSocketsReader : public CActive
    {
public:
/*!
  @function NewL
   
  @discussion Create a CSocketsReader object
  @param aEngineNotifier An observer for status reporting
  @param aSocket socket to read from
  @result a pointer to the created instance of CSocketsReader
  */
	static CSocketsReader* NewL(MEngineNotifier& aEngineNotifier, RSocket& aSocket);

/*!
  @function NewLC
   
  @discussion Create a CSocketsReader object
  @param aEngineNotifier An observer for status reporting
  @param aSocket socket to read from
  @result a pointer to the created instance of CSocketsReader
  */
    static CSocketsReader* NewLC(MEngineNotifier& aEngineNotifier, RSocket& aSocket);

/*!
  @function ~CSocketsReader
  
  @discussion Destroy the object and release all memory objects
  */
	~CSocketsReader();

/*!
  @function Start

  @discussion Initiate a read from socket
  */
	void Start();

protected: // from CActive
/*!
  @function DoCancel
   
  @discussion cancel any outstanding operation
  */
	void DoCancel();

/*!
  @function RunL
   
  @discussion called when operation complete
  */
	void RunL();	

private:
/*!
  @function CSocketsReader
  
  @discussion Perform the first phase of two phase construction 
  @param aEngineNotifier An observer for status reporting
  @param aSocket socket to read from
  */
	CSocketsReader(MEngineNotifier& aEngineNotifier, RSocket& aSocket);

/*!
  @function ConstructL
  
  @discussion Perform the second phase construction of a CSocketsReader 
  */
	void ConstructL();

/*!
  @function IssueRead

  @discussion Initiate a read from socket
  */
	void IssueRead();

private: // Member variables

    /*! @const The size of the read buffer in bytes */
    enum {KReadBufferSize = 20};

    /*! @var socket to read data from */
    RSocket&                iSocket;

    /*! @var An observer for status reporting */
	MEngineNotifier&        iEngineNotifier;

    /*! @var buffer for receiving data */
	TBuf8<KReadBufferSize>  iBuffer;

    /*! @var dummy - length of data read is written here */
    TSockXfrLength          iDummyLength;
    };

#endif // __SOCKETSREADER_H__

⌨️ 快捷键说明

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