Hi,
Thanx for your fast reply.
Nope I didn't touch the modem at all, it's just that the text in the
messages will not appear. The inbound message notification will be triggered
as usual, but the SMS will have the word 'corrupted' in the phone's inbox
instead of its original text. Nothing like this happens if I simply runs
this code without a thread like this;
ReadMessages sms = new ReadMessages();
try
{
sms.doIt();
} catch (Exception ex)
{
System.out.println("SMS Server failed to start : " + ex);
System.exit(-1);
}
and yes, I only intended the SMS server to run for a single thread execution
and not invoke any other thread calling this function.
I just basically wants it the gsm modem to detects any incoming messages
while other tasks are doing their jobs (i.e sensor value reading task)
so u think I should take out this part and put it on a thread for this
purpose?
msgList = new ArrayList<InboundMessage>();
this.srv.readMessages(msgList, MessageClasses.ALL);
for (InboundMessage msg : msgList)
System.out.println(msg);
Cheers!
vash
On Tue, Aug 4, 2009 at 8:42 PM, Thanasis <[email protected]> wrote:
> Hi,
>
> Hmm... I don't really get this...
>
> You are referring to corrupted messages - could you explain? Do you mean
> that your modem gets disconnected or that messages are corrupted (i.e. wrong
> text, etc)?
>
> Your example will run fine for a single thread execution, BUT its not
> efficient at all. During each thread invocation, you will start and stop the
> main Service class, which takes time. Start the Service object once and run
> the readMessages() method in a thread.
>
> 2009/8/4 vash1282 <[email protected]>
>
>
>> Hi Mr Thanasis,
>> This might be a trivial question to you, but I'd appreciate some
>> pointers regardless.
>>
>> Is it possible for SMS lib classes to run simultaneously along other
>> tasks in java by assigning it to a thread? Everytime I use this code,
>> the sms I sent to the gsm modem will become corrupted most of the
>> time, and when it is not corrupted, the automated reply will not be
>> sent out from the gsm modem.
>> however, when I take out the threads .. it runs fine on its own, but I
>> need it to be running simultatneously with another thread.
>>
>> this is how I assigned the class to a thread in my main function; runs
>> fine except that 50% of the incoming SMSs will be corrupted.. if
>> there's any other way to do it pls advise..
>> Cheers!
>>
>> ======================================================
>>
>> Thread r = new Thread(){
>> public void run()
>> {
>> ReadMessages sms = new ReadMessages();
>> try
>> {
>> sms.doIt();
>> } catch (Exception ex)
>> {
>> System.out.println("SMS Server failed to start : " + ex);
>> System.exit(-1);
>> }
>> }
>> };
>> r.start();
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SMSLib User Group" group.
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
-~----------~----~----~----~------~----~------~--~---