please leave here a clue where I could make a mistake:
The waiting for incoming sms is triggered by method Idle() in CActive class with EPriorityStandard:
The SocketListen() looks like this:
if ( !IsActive() )
//User::After(1000000); //I tried both versions
And the problem is that the execution stops - freezes on the line iSmsMessage->InternalizeL(readStream). That is understandable as there was no incoming sms yet. The RunL() is triggered and I do not know why.
//Opens a socket by creating a new subsession to the socket server.
TInt err = iSocket.Open(iSocketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
// App. listens for sms msgs with some special tag in it.
TInt BindErr = iSocket.Bind(smsaddr);
if(BindErr == KErrNone)
iPckgBuf() = KSockSelectRead;
//Applies an asynchronous I/O control operation on a socket.
iSocket.Ioctl( KIOctlSelect,iStatus, &iPckgBuf, KSOLSocket);
if(iStatus == KErrNone)
if(iRead && iGlobalProperties.GetSecurePhone() )
CSmsBuffer *smsBuffer = CSmsBuffer::NewL();
//Stream that reads a CSmsMessage object across a socket.
//Allocates and creates a CSmsMessage
//ESmsDeliver-SMS-DELIVER, sent from service center to Mobile Station.
iSmsMessage = CSmsMessage::NewL(iFs,CSmsPDU::ESmsDeliver,smsBuffer);
//Internalises data from stream to CSmsMessage
//Extracting the received message to a buffer
iSocket.Ioctl( KIoctlReadMessageSucceeded,iStatus, &iPckgBuf, KSolSmsProv);
//Printing the received Message.
//CAknInformationNote* note122=new(ELeave) CAknInformationNote;