I'm IOCancelledException?

I'll send SMS to more than one number. And a problem with this exception.

When it occurs?

Please help me...

Code is:

' Public Sub sendMessage (vector num, String message)
{
for (int f = 0; f)<>
{
String number = (String) num.elementAt (f);
            
SendSMS sms = new SendSMS (number, message);
System.out.println ("* START SMS *");
            
System.out.println ("*" + number + "*");
SMS. Start();
}
}

SerializableAttribute public class SendSMS extends Thread {}
MessageConnection conn = null;
TextMessage text = null;
The address of the string;
String message;
    
public SendSMS (String addr, String msg) {}
Message = msg;
address = addr;
            
}
public void run() {}
        
try {}
                
Switch (getNetType ())
{
                   
case CDMA:
Try
{
DatagramConnection connection = null;
System.out.println ("BODY *" + message);
ubyte bytes [] = message.getBytes ();           body.getBytes ();
connection = Connector.open (DatagramConnection) ("sms: / /"+ address '); ("/ / +": 5000 ");
Datagram in datagram = connection.newDatagram (bytes, bytes.length);
Connection.Send (datagram);
}
catch (Exception e1)
{
System.out.println(E1+"---Datagram--SEMD--exception---");
}
break;
                               
IDEN-case: / / / break;
                   
case GPRS:
Try
{
                                   
String smsConnection = "sms: / /"+ address; " OPEN_STRING;
MessageConnection smscon = (MessageConnection) Connector.open (smsConnection, Connector.READ_WRITE);
TextMessage msg = (TextMessage) smscon.newMessage (MessageConnection.TEXT_MESSAGE);
System.out.println ("BODY GPRS *" + message);
msg.setPayloadText (message);
smscon. Send (MSG);
} catch (Exception e2) {}
System.out.println(E2+"--sending---SMS---GPRS-exception---");
}
break;
                                    
}
}
catch (Exception e) {}
System.out.println ("Exception: Send Msg:" + e);
}
}
   
}
public final static int GPRS = 0;
public final static int CDMA = 1;
public final static int IDEN = 2;
   
public static int getNetType()
{
         
If (RadioInfo.getNetworkType () == RadioInfo.NETWORK_GPRS)
{
return the GPRS;
}
Another yew (RadioInfo.getNetworkType () is RadioInfo.NETWORK_CDMA)
{
return of CDMA;
}
Another yew (RadioInfo.getNetworkType () is RadioInfo.NETWORK_IDEN)
{
return IDENTITY;
}
           
return the GPRS;
}

Use sms.run () instead of sms.start)

Tags: BlackBerry Developers

Similar Questions

  • Download of BIS-B connection limiting

    Hi all

    Is there anyone come cross on the connection http BIS-B download limitation.

    I remebered I saw this somewhere, but now I can't find it.

    Today, when I tested my application, I get an IOCancelledException via an http BIS-B connection.

    When I reduce the size of file to download, it's OK.

    Thanks in advance.

    We have an internal idea that BIS - B has a maximum request size of ~ 60K.

    Since we have data (sync) that exceed this size, divide us the data into pieces that are awlays<>

    Now, this could be a remnant of the previous levels of release, I'm not positive that it is a limitation published.

    Another question, you will find the same type of limitation of BES - although the size of the query is defined by the administrator of BES. It's one more reason why we have chosen a small packet size to eliminate the problem.

  • Download the image via httpConnection very slowly

    I've been wroted a function to get a picture from the internet, the size of the image always in 50x50px, very small, but I have to waste a lot of time for reveiving given, here is my code:

    package code;
    
    import java.io.IOException;
    import java.io.InputStream;
    
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    
    import net.rim.device.api.io.IOCancelledException;
    import net.rim.device.api.io.IOUtilities;
    import net.rim.device.api.ui.UiApplication;
    
    public class HttpUtility
    {
        private static byte[] _imageData;
        private static String _url;
    
        public static byte[] getInternetImage(String url, boolean waiting)
        {
            _url=url;
            _imageData=null;
    
            Runnable run=new Runnable()
            {
                public void run()
                {
                    byte[] data=null;
    
                    try {
                        HttpConnection httpConnection=(HttpConnection) Connector.open(_url+Function.updateConnectionSuffix());
                        InputStream inputStream=httpConnection.openInputStream();
    
                        if(inputStream.available()>0)
                        {
                            data=IOUtilities.streamToBytes(inputStream);
                            inputStream.read(data);
    
                            _imageData=data;
                        }
                    } catch(IOCancelledException e2) {Function.errorDialog(e2.toString());}
                      catch (IOException e) {Function.errorDialog(e.toString());}
                }
            };
    
            if(waiting)
            {
                UiApplication.getUiApplication().invokeAndWait(run);
            } else {
                UiApplication.getUiApplication().invokeLater(run);
            }
    
            return _imageData;
        }
    }
    

    The updateConnectionSuffix() to determine the network environment and choose a better way for httpConnection.

    Is there a problem in my code? I have no idea

    invokelater executes on the thread of the event, and not on a separate thread.
    currently you block your UI until data is available.

    See
    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

    Take a look at the httpdemo to see how you could do it better.

Maybe you are looking for

  • The size of the maximum and accessories of the A10 series micro sd card

    So, what is the exact limit for players? If it is stuck at 128 GB? Or it would cooperate with the future larger capacity cards? And American stores will be sold to the Japan soft cases? Where can I find a protective screen for this instead of cut min

  • problem with / s digital correlated on USB-6341

    I'm testing an application that fact/s digital correlated, written in C++ with a USB-6341. I use NEITHER-DAQmx version 16.0.0f0. Because this application will be used by people with a variety of different DAQ hardware, I tried to write it to manage a

  • types of files in llb

    Hello I am looking for a complete list of the types of files that can be saved in *.llb. Y at - it all? Thanks in advance!

  • Pavilion a6544f does not recognize SATA hard drive

    I'm running Vista on this machine and added a second internal hard drive: a WD Caviar 1 TB GB. I connected the SATA cable to the SATA connector to blue color on the motherboard (Benicia-GL8E) and had to get a 4 pin to SATA power plug on the power cab

  • 15 - ro33tx: change screen loptop to touch

    Hello It is possible to make a notebook for a capacitive touchscreen display