This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connector.open() gets stuck??

 
chetan dhewal
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying this code for sending and receiving sms.
The midlet doesnt execute after the call to Connector.open() method.
When executed , after call to open() the emulator ask for "permission" to use message. I click yes/no but the emulator doesnt grant permission and nothing happens. The midlet gets stuck at this alert(permission to use message). I hav given the permission for send& receive in project setting also but avail to no use.

Code...
---------------------------
for receiving:-
msgcon=(MessageConnection) Connector.open("sms://:1234");

for sending:-
msgcon=(MessageConnection) Connector.open("sms://5550000:1234");

---------------------------

the execution of midlets stops on both send/receive open() calls, at the permission alert.

Thnx
 
avi aro
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Do you have network access while using emulator. Please note that while you are behind the proxy, you should make sure that you set the proxy settings in order for emulator to connect to network.
Thanks,
 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think this is due a fundamental rule of IO. Did you open the connection in a different thread. If not the UI gets frozen. Always do the IO in a new thread. Regards.
 
chetan dhewal
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

The problem was , i dint do the call to open in a different thread, i did it in the commandaction() , the sun emulator was throwing a warning to open the connection in different thread, bt i overlooked it since it was just warning. now i hav come to know that the Sun emulator doesnt let the code go forward if the open()/send()/receive() calls arn't made in seperate thread.

I made 2 different classes for sending and receiving (both implementing Runnable) and put the open+receive and open+send code in their respective run method and guess what the code ran smoothly.

Thnx
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic