×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    7

    timeout when sending sms in J2ME

    Hi,
    I have a problem sending SMSs in J2ME. This is the code I'm using

    int port = 50000;
    String url = "sms://" + AppSettings.getInstance().getCurrentMatch().getPhoneNumber() + ":" + port;
    MessageConnection messageConnection = null;
    try {
    messageConnection = (MessageConnection)Connector.open(url);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    //messageConnection.setMessageListener(this);

    if (messageConnection != null) {
    TextMessage textMessage = (TextMessage)messageConnection.newMessage(
    MessageConnection.TEXT_MESSAGE, url);
    textMessage.setPayloadText(_smsText.getText());
    try {
    Logger.info("sending");
    Logger.info(url);
    messageConnection.send(textMessage);
    Logger.info("sent");
    } catch (InterruptedIOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }

    What happens is that the application freezes for a few seconds, then I get this error:

    java.io.IOException: SymbianOS error = -33 : General:
    Operation time-out (-33)
    at com.symbian.util.NativeError.checkIO(NativeError.java:139)
    at com.symbian.gcf.ConnectionEndPoint.checkError(ConnectionEndPoint.java:421)
    at com.symbian.javax.wireless.messaging.MessageClientConnectionImpl.send(MessageClientConnectionImpl.java:235)
    at forms.SendSmsForm.process(Unknown Source)
    at library.FormManager.process(Unknown Source)
    at forms.MainMidlet.widgetSelected(Unknown Source)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:85)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:751)
    at org.eclipse.swt.widgets.Widget.internal_sendEvent(Widget.java:772)
    at org.eclipse.swt.internal.symbian.OS.Display_ReadAndDispatch(Native Method)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1252)
    at forms.MainMidlet.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    Can anybody help on this?

    Thanks,
    Marco

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: timeout when sending sms in J2ME

    On which device you are trying this, trying change the port no to something else, 50000 may be reserved port.

    thanks,
    ~Amitabh

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Ahmedabad
    Posts
    254

    Re: timeout when sending sms in J2ME

    Hi,

    Also, please try to check on other device too. Is the code working properly in the emulator? Try to change the port and the handset too.
    Sunil
    Mobile Application Developer

  4. #4
    Registered User
    Join Date
    Nov 2009
    Posts
    7

    Re: timeout when sending sms in J2ME

    Quote Originally Posted by sunil_bhambani123 View Post
    Hi,

    Also, please try to check on other device too. Is the code working properly in the emulator? Try to change the port and the handset too.
    I have tried this on an emulator, not an actual device. Also, I've tried to use several different port numbers, always with the same error.

    Thanks,
    Marco

  5. #5
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Ahmedabad
    Posts
    254

    Re: timeout when sending sms in J2ME

    Hi,

    You are sending SMS to a port, then you should have the receiver listening on that port for the SMS. Have you done that properly? In which emulator are you testing? Try to test it on Sun Wireless Toolkit, it provides support for sending and receiving SMS on particular port.

    Otherwise, remove the port and just provide the number and then see whether the SMS goes or not.
    Sunil
    Mobile Application Developer

Similar Threads

  1. loading and sending an sms
    By marwa mohamed in forum Symbian
    Replies: 2
    Last Post: 2006-06-07, 15:19
  2. 3410 J2ME Problem Sending SMS on Server connection
    By keithmarsh in forum Mobile Java General
    Replies: 1
    Last Post: 2002-09-06, 08:35
  3. Sending and receiving SMS messages from J2ME application
    By nkn_motoko in forum Mobile Java General
    Replies: 1
    Last Post: 2001-11-06, 20:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×