?? gsdpport.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 + -