Hi to all!
I want to send a silent sms, so i try the wiki example, but the application crashes in this line:
iSocket.Ioctl(KIoctlSendSmsMessage,iStatus,&sendBuffer,KSolSmsProv);
this is my code, what i´m doing bad? I´m working with a nokia n70
Thanks in advanceCode:void Csilentsms::SMSSendL() { RFs iFileSession; RSocketServ iSocketServer; RSocket iSocket; //iFileServer is RFs object iFileSession.Connect(); //iSockerServer is RSocketServ object iSocketServer.Connect(); //iSocket is RSocket Object TInt err1 = iSocket.Open(iSocketServer,KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol); if(!err1) { //SMS address for a socket. TSmsAddr smsaddr; //Only for sending, no reception. smsaddr.SetSmsAddrFamily(ESmsAddrSendOnly); smsaddr.SetPort(5000); TInt BindErr1= iSocket.Bind(smsaddr); if(BindErr1 == KErrNone) { CSmsBuffer *buffer = CSmsBuffer::NewL(); CleanupStack::PushL(buffer); //Inserting msg. to be sent to a buffer buffer->InsertL(0, _L("my message")); //Stream that writes a CSmsMessage object across a socket RSmsSocketWriteStream writestream(iSocket); //ESmsSubmit-SMS-SUBMIT, sent from Mobile Station to Service Center CSmsMessage* iSmsMessage; iSmsMessage = CSmsMessage::NewL(iFileSession,CSmsPDU::ESmsSubmit, buffer); //Sets the message Service Center Address via which msg. //will be sent to receipent //iSmsMessage->SmsPDU().SetServiceCenterAddressL(_L("+01234567890")); //Sets destination number iSmsMessage->SmsPDU().SetToFromAddressL(_L("+123456789")); //Externalises message to a stream which is used for //writing data into the socket iSmsMessage->ExternalizeL(writestream); //Ensures that any buffered data is written to the stream. writestream.CommitL(); TPckgBuf<TInt> sendBuffer; sendBuffer=KSockSelectWrite; //Applies an asynchronous I/O control operation on a socket. TRequestStatus iStatus = KRequestPending; iSocket.Ioctl(KIoctlSendSmsMessage,iStatus,&sendBuffer,KSolSmsProv); CleanupStack::PopAndDestroy(buffer); } } }





