src/SmsReceiver.cpp
void CSmsReceiver::StartListeningL()
    {
    // we can't handle several requests simultaneously
    if (IsActive())
        {
        User::Leave(KErrNotReady);
        }

    // just in case
    iReadSocket.Close();
    
    // open read socket
    User::LeaveIfError(iReadSocket.Open(iSocketServ,
                                        KSMSAddrFamily,
                                        KSockDatagram,
                                        KSMSDatagramProtocol));

    _LIT8(KMathTag, "#:!");

    // set match pattern
    TSmsAddr smsAddr; 
    smsAddr.SetSmsAddrFamily(ESmsAddrMatchText); 
    smsAddr.SetTextMatch(KMathTag); // put KNullDesC8 to catch all messages
    
    // use this to read the message from a certain port
    //smsAddr.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
    //smsAddr.SetPort(16500); // GSM Application port from 16000 to 16999 
    
    // bind the socket
    User::LeaveIfError(iReadSocket.Bind(smsAddr));
    iBuf() = KSockSelectRead;
    
    Start();
    }
// ---------------------------------------------------------------------------
// CSmsReceiver::StartListeningL()
// Starts listening for an incoming SMS.
// ---------------------------------------------------------------------------
//

:StartListeningL()
Starts listening for an incoming SMS.
: StartListeningL () Starts listening for an incoming SMS .
void CSmsReceiver::StartListeningL()
    {
    if (IsActive())
        {
        User::Leave(KErrNotReady);
        }
    iReadSocket.Close();
    User::LeaveIfError(iReadSocket.Open(iSocketServ,
                                        KSMSAddrFamily,
                                        KSockDatagram,
                                        KSMSDatagramProtocol));
    _LIT8(KMathTag, "#:!");
    TSmsAddr smsAddr; 
    smsAddr.SetSmsAddrFamily(ESmsAddrMatchText); 
    smsAddr.SetTextMatch(KMathTag); 
    User::LeaveIfError(iReadSocket.Bind(smsAddr));
    iBuf() = KSockSelectRead;
    Start();
    }
void CSmsReceiver :: StartListeningL ( ) { if ( IsActive ( ) ) { User :: Leave ( KErrNotReady ) ; } iReadSocket . Close ( ) ; User :: LeaveIfError ( iReadSocket . Open ( iSocketServ , KSMSAddrFamily , KSockDatagram , KSMSDatagramProtocol ) ) ; _LIT8 ( KMathTag , " " ) ; TSmsAddr smsAddr ; smsAddr . SetSmsAddrFamily ( ESmsAddrMatchText ) ; smsAddr . SetTextMatch ( KMathTag ) ; User :: LeaveIfError ( iReadSocket . Bind ( smsAddr ) ) ; iBuf ( ) = KSockSelectRead ; Start ( ) ; }
CSmsReceiver::StartListeningL()
Starts listening for an incoming SMS.
CSmsReceiver :: StartListeningL () Starts listening for an incoming SMS .
// we can't handle several requests simultaneously
 // just in case
 // open read socket
 // set match pattern
 // put KNullDesC8 to catch all messages
 // use this to read the message from a certain port
 //smsAddr.SetSmsAddrFamily(ESmsAddrApplication8BitPort);
 //smsAddr.SetPort(16500); // GSM Application port from 16000 to 16999 
 // bind the socket
