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

📄 gsdpport.cpp

📁 Symbian mobile os C++ GSDP编程
💻 CPP
字号:
// gsdpport.cpp
//
// Port allocator for the GSDP server
//
// Copyright (c) 2000-2002 Symbian Ltd.  All rights reserved.

#include "gsdpserver.h"

#include <f32file.h>
#include <s32file.h>

/*
	class CGsdpPortAllocator
*/

// construct/destruct

void CGsdpPortAllocator::ConstructL()
	{
	User::LeaveIfError(iFs.Connect());
	RFileReadStream stream;
	stream.PushL();
	TInt err=stream.Open(iFs, KGsdpPortAllocationFile, EFileRead | EFileWrite);
	if (!err)
		{
		iNextPortId=stream.ReadInt32L();
		}
	else if (err==KErrNotFound)
		{
		iNextPortId=0;
		NextPortId();
		}
	else
		User::Leave(err);
	CleanupStack::PopAndDestroy(); // stream
	}

CGsdpPortAllocator::~CGsdpPortAllocator()
	{
	iFs.Close();
	}

// utility

TUint32 CGsdpPortAllocator::NextPortId()
	{
	iNextPortId++;
	RFileWriteStream stream;
	stream.PushL();
	User::LeaveIfError(stream.Replace(iFs, KGsdpPortAllocationFile, EFileRead | EFileWrite));
	stream.WriteInt32L(iNextPortId);
	stream.CommitL();
	CleanupStack::PopAndDestroy(); // stream
	return iNextPortId;
	}

⌨️ 快捷键说明

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