Hi Wim,

You are right, this is a valid scenario that would lead to process errors.

I don't know which solution is the best. I tend to think that solution #2 
is the simpler to do, although maybe not the most efficient. Relying on 
READ/UNREAD would not be my first choice, as I have seen that these don't 
work very nice on some phones...

In any case,  if you wish to look into this further and possibly contribute 
an answer, please open an issue (http://code.google.com/p/smslib/issues/list
).

Thanks :)

On Wednesday, March 14, 2012 5:47:12 PM UTC+2, wim stevens wrote:
>
> Hello, 
>
> It happens (too many times) that my application receives the same 
> message multiple times. 
> I believe I know the source of the problem.  I have some suggestions 
> for solving the issue. 
>
> Conditions to reproduce the problem 
>   - Unsolicited messages must have been enabled 
>   - You must have simultaneous inbound and outbound traffic.  I do 
> this by sending one large multipart SMS from Smslib to a mobile 
> phone.  On the mobile phone I send 10 times a one word SMS to smslib 
>
> What happens (in words - no Java code) 
>
> - Smslib wakes up by the unsolicited notification 
> - Smslib queries the modem for the list of messages (AT+CMGL=4) 
> - The modem answers with the partial list of received sms messages 
> (assume sms 1, 2 and 3 have been received) 
> - Another thread tries to send outbound messages 
> - The application that is using smslib is not yet informed about the 
> new sms messages 
> - A new SMS comes in -> a new unsolicited notification 
> - Smslib queries the modem for the list of messages (AT+CMGL=4) and 
> gets in return the initial 3 messages + some new messages 
> - .... 
> - the application processes the received messages and send delete 
> commands to the modem. 
>
> The reason for the duplicate SMS messages is one of 
> - the delete comes too late.  There should be no unsolicited messages 
> between the reading of the messages and the deletion of the messages 
> - smslib always asks for "all messages".  Why not asking for "unread 
> messages" or discarding the read messages. 
>
> Some solutions 
> - the CNMI emulator process and the AsyncMessageProcession should not 
> call getGateway().readMessages(this.msgList, MessageClasses.ALL); but 
> getGateway().readMessages(this.msgList, MessageClasses.UNREAD); 
> However there is a risk that read messages never get deleted 
>
> - the method readMessagesPDU (and readMessagesTEXT) should send the 
> delete command just after receiving the list of messages.  Reading and 
> deleting the messages must be done within a single synchronized 
> (getSYNCInboundReader()) block 
>
> - messages are received from the modem in a +CMGL answer (e.g. +CMGL: 
> 1,0,,21)  Smslib could discard all CMGL entries that have the status 
> parameter equal to 1 (read message) 
>
> - disable all unsolicited notifications and use the CNMI emulator to 
> read messages.  This works fine on my Cinterion modem.  However the 
> Sierra Wireless Fastrack Xtend 009 modem no longer send delivery 
> notifications when CNMI has been disabled completely 
>
>
>
> I could make the modifications to the code.  What solution would you 
> prefer (or do I miss something) 
>
> Regards 
>
> Wim Stevens

-- 
You received this message because you are subscribed to the Google Groups 
"SMSLib Discussion Group" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/smslib/-/d70lk3UNUgMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/smslib?hl=en.

Reply via email to