• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Couldn't MMS coexist with SMS?

 
ryan zeng
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem 1. if open the MMSListener and SMSListener simultaneously, there is only one which was opened first effective.
such as:
*************
....
MessageConnection mmsconn = (MessageConnection) Connector.open("mms://:8888");

mmsconn.setMessageListener(this);
MessageConnection smsconn = (MessageConnection) Connector.open("sms://:6666");

smsconn.setMessageListener(this);
.....
public void notifyIncomingMessage(MessageConnection conn) {

...
System.out.println("start receive..");
Message msg = conn.receive();
System.out.println("receive complete!");
...
}
*****************
here it can receive multimessage from 888 port.But can not receive textmessage or binarymessage from 6666 port with no exception thrown.there is only
"start receive..." printed.

PS:even remove "mmsconn.setMessageListener(this)" the result is same.
vice versa.

problem 2.it need to shut down mmslistener before send multimessage(sms need not).But if mmslistener was opened before smslistener,then it must shut down all listeners before send sms_message.
such as.
(1)
*******
MessageConnection smsconn = (MessageConnection) Connector.open("sms://:6666");
smsconn.setMessageListener(this);
MessageConnection smsSendconn = (MessageConnection) Connector.open("sms://+XXXX:6666");
......
smsSendconn.send(shortmessage);
*******
this is Ok!
(2)
**********
MessageConnection mmsconn = (MessageConnection) Connector.open("mms://:8888");
mmsconn.setMessageListener(this);
....
MessageConnection mmsSendconn = (MessageConnection) Connector.open("mms://+XXXX:8888");

......
mmsSendconn.send(multimessage);
..
********
In the case,it will throw IOException:Connection closed.
but the mmsSendconn hasn't been closed actually.And if closed mmsconn before send multimessage,then everything goes well.
Like this:
*****
mmsconn.close();
mmsSendconn.send(multimessage);
****
OK!
(3)
MessageConnection mmsconn = (MessageConnection) Connector.open("mms://:8888");
MessageConnection smsconn = (MessageConnection) Connector.open("sms://:6666");
smsconn.setMessageListener(this);

MessageConnection smsSendconn = (MessageConnection) Connector.open("sms://+XXXX:6666");

......
smsSendconn.send(shortmessage);
..
Int this case,the phenomena is the same with (2),all is ok after closed mmsconn and smsconn.

**********
I have tried putting them into different thread,but it is ineffective.
Thanks for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic