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

📄 symsock.h

📁 Simple Jabber Client for Symbian Platform
💻 H
字号:
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  Jabber
 *  Copyright (C) 2004 Xie Tian Lu  http://sabber.jabberstudio.org/
 */



#ifndef __SYMSOCK_H__
#define __SYMSOCK_H__

#include <es_sock.h>
#include <in_sock.h>
#include "Notify.h"

class MUINotify;
class CTimeOutTimer;
class CSockReader;
class CSockWriter;

/*
enum {
	SYMSOCK_STATE_OFF,
	SYMSOCK_STATE_FINISHED,
	SYMSOCK_STATE_FAILED
};
*/

class CSymSocket : public CActive, public MTimeOutNotify, public MSockOwner
{
public:

public:
	static CSymSocket* NewL ( MUINotify* aConsole, TUint aRCacheSize, TUint aWCacheSize );
	static CSymSocket* NewLC( MUINotify* aConsole, TUint aRCacheSize, TUint aWCacheSize );

public:
	//Implemented functions from MSockOwner
	void SocketEvent( TSymSocketState aState );
	TInt HasSocketClosed();
	TUint GetProtocol();
	//Implemented functions from MTimeOutNotify
	void TimerExpired(); 
	//Implemented functions from CActive
	void DoCancel();
	void RunL();

public:
	TSymSocketState GetCurStatus();

	void SetServer( const TDesC& aServerName, TUint16 aPort, TUint aProtocol );
	void SetServerName( const TDesC& aServerName );
	void SetServerPort( TUint16 port );
	void ConnectL();
	void Stop();
	void Close();

	int  Send( const char* buf, int len, int flags );
	int  Recv( char* buf, int len, int flags );

	int CSymSocket::SendTo( const char* buf, int len, TInetAddr dest );
	int CSymSocket::RecvFrom( char* buf, int len, TInetAddr& from );

	//int	 SendTo( const char* ip, short port, const char* buf, int len, int flags );
	//int  RecvFrom( char* ip, short& port, char* buf, int len, int flags );

	~CSymSocket();

protected:
	CSymSocket();
	void ConstructL( MUINotify* aConsole, TUint aRCacheSize, TUint aWCacheSize );

public:

protected:
	TSymSocketState		iSocketStatus;
	MUINotify*			iUi;
	CSockReader*		iReader;
	CSockWriter*		iWriter;
	CTimeOutTimer*		iTimer;
	TInetAddr			iAddress;
	RSocket				iSocket;
	RSocketServ			iSocketServ;
	RHostResolver		iResolver; 
	TInt				iTimeOut;
	TNameEntry			iNameEntry;
	TNameRecord			iNameRecord;
	TUint				iProtocol;
	TInt				iCacheSize;
};

#endif

⌨️ 快捷键说明

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