Hi again
Not getting any response, I decided to explain the situation more.
I have a class which make it easy for me to write to and read from ports easily. In the factory function of this class i take a RCommServ object and a TCommPort object which were opened and configured before. For Example:
Code:
class MyPortClass : public CActive
{
public:
static MyPortClass* NewL(MyPortClassObserver&, RCommServ&, TCommPort&);
void SendL(TDesC&);
void ReceiveL(TDesC&);
.
.
private:
InitializeL(RCommServ&, TCommPort&);
.
RComm iComm;
.
};
In the InitilizeL() method I always get an error like KErrAccessDenied, KErrLocked,....
The implementation of InitilizeL() is:
Code:
void MyPortClass::Initialize(RcommSer& aServer, TCommPort& aPort)
{
.
// I always get an error here.
User::LeaveIfError(iComm.Open(aServer, aPort.iPort, ECommShared, ECommRoleDCE));
.
}
If I change the ECommRoleDCE to ECommRoleDTE the error would be solved.
Whats the differences between these enumerators?
Why I get KErrLocked when I opened the port by ECommShared?
If I just create one instance of MyPortClass in my project, I get KErrAccessDenied and if I creat e more objects i get KErrLocked.