SocketConnection sends only little data. (Works in the Simulator)

Hi guys,.

I am writing an app that some works on the phone and then sends a block of reasonable size of data to a server (about 1.5Meg to 20Meg).

The problem is that the phone seems to only send about 16 KB of data before it stops and does nothing until the connection times out and closes.

I use Wifi via a VPN to send this data.

It works very well in the Simulator, but just does not work when I deploy on a phone.

Any ideas?

Here is the code:

DataBuffer buffer = new DataBuffer();
buffer.writeInt (sizeOfData);
buffer.writeShort (Constants.SAVE_SITE_AUDIT);
byte[] data = getProcessedData(); // Returns about 1.5 to 20 Megs of data
buffer.write(data);

SocketConnection sc;
sc = (SocketConnection) Connector.open ("socket://10.0.1.5:2000";interface=wifi;deviceside=true", Connector.READ_WRITE);

DataOutputStream out = sc.openDataOutputStream();
DataInputStream in = sc.openDataInputStream();

out.write(buffer.getArray()); // Hangs here only sending about 16k of data
out.flush();

if (in.readShort() == Constants.FAIL){
etc....
}else

Thank you

MOF.

First thing is to make sure that you expand on the appropriate level of the operating system.  So for the 4.6.1 peripheral, you have developed using 4.6.1/4.6 and 4.7 or 5.0.

Tags: BlackBerry Developers

Similar Questions

  • App works on the Simulator, but not on the device

    Just try to run the helloworlddemo app compiles fine and works on the Simulator without problem. All I get on the device is an icon of the application that does nothing when clicked.

    I had read this might have to do with the version of the JDE is high for the operating system on the device, but I'm running JDE 6.0.0.37 and the operating system on the device is 6.0.0.666

    I tried with my own app first, compiled, signed it and get the same result as helloworld, then its certainly some mounted sort of question but I have no idea of what

    Thank you

    Sheldon

    Thought of it - was to set the permission of application so that all 3 items were "allow."

  • Only one speaker works on the bottom of the phone

    All the documentation that comes with the Turbo 2 and online documentation I've seen before buying indicate that there are two audio ports on the bottom of the phone, one on each side of the Verizon logo. However, only the side right (while facing the phone) actually works. The left speaker does not work. Verizon, which did not, I called and they put someone in support of Motorola on the line. The motorcycle rep says absolutely the two speakers should work and my phone is defective. They suggested that I return it as a guarantee of Exchange. I'm happy to do, but before I did I stopped by a verizon store and checked four phones they had on display. All four phones had the same "defect". So is - can anyone clarify if both speakers work on any Turbo 2 phones?

    I was also wondering with all these mixed news, but there's a tear down video on YouTube which shows clearly there is only one speaker. I hear only on the bottom right, that nothing about ports to the left on mine.

  • KSOAP2 working on the Simulator, but failed on the device. Help, please!

    Hi all. Please, I need support on this issue.

    I have a request of KSOAP2 running which:

    1) Œuvres ALLWAYS on the Simulator (9700 Simulator)

    2) FAILS on the device when you use 3 G Internet Link

    3) work on the device when hard reseting it and directly using Wi - Fi link (if you switch to 3 G, it starts failing).

    When it do I get the following error:

    type of org.xmlpull.v1.XmlPullParserException:Unexpected (position: TEXT SocketException:...@1:33 in java.io.InputStreamReader@hexhere)

    Some other times I get an IO error faced:

    net.rim.device.cldc.io.ippp.SocketBaseIOException: Connection timed Out

    The funny thing is that it works through 3 G as 1 in 40 times... it seems that 3 G connection is too slow to KSOAP2 to work properly, or something like that. The complex type is small (8 strings).

    My webservice is a webservice VB.NET located on the production IIS server. It works well because it responds to any request of Simulator.

    Additional data:

    -Other Internet applications of device (such as the Internet browser) works well through 3G even when my application does not always succeed. Coverage of 3G service is excellent.

    -J' use JRE 5.0.0.

    -Device is a BlackBerry Bold 9700

    -Webservice is written in VB.NET in the production on the Internet Server, and it works perfectly because it responds to each request of Simulator.

    -J' use javaloader.exe to deploy the cod to the device files (both, ksoap library cod and cod of my project)

    -L'application is not signed.

    -Once the application starts breaks down (when you switch to 3G) it maintains in default if you return to the WiFi again.

    Here is my code:

    String res="";
    boolean error=false;
    Vector seguimientos = null;
    
    SoapObject m_Soapobject=new SoapObject("urn:tempuri", "GetSeguimientos");
    SoapSerializationEnvelope m_Envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
    m_Envelope.encodingStyle = SoapSerializationEnvelope.ENC;
    
    m_Soapobject.addProperty("strInstance", "r2sistemas");
    m_Soapobject.addProperty("user", "myuser");
    m_Soapobject.addProperty("password", "mypassword");
    m_Soapobject.addProperty("comercialId", "3");
    
    m_Envelope.addMapping("urn:tempuri/encodedTypes", "Seguimiento", new Seguimiento().getClass());
    m_Envelope.bodyOut = m_Soapobject;
    m_Envelope.setOutputSoapObject(m_Soapobject);
    
    HttpTransport ht = new httpTransport("http://www.productionserver.com/service1.asmx");
    ht.setXmlVersionTag("");
    
    try {
        ht.call("urn:tempuri/GetSeguimientos", m_Envelope);
        SoapObject respuesta=(SoapObject)m_Envelope.bodyIn;
        seguimientos=(Vector)respuesta.getProperty(0);
        } catch (IOException e) {
        error=true; res="IO Problem: " + e.toString();
        } catch (XmlPullParserException e) {
        error=true; res="XMLParser problem: " + e.toString();
        }
    
    if(error!=true) {
        Seguimiento seg=(Seguimiento)seguimientos.elementAt(1);
        res=seg.Comentario;
        }
    
    this.add(new LabelField("aa"+ res));
    

    I read on this forum that ksoap2 cannot treat the http error messages. You must download the KSOAP source and change it to do this. Something like ServiceConnectionMidp. The message is this: link

    I use a port KSOAP2 library: ksoap2-j2me-core-prev - 2.1.2.jar, like I said it works fine on the Simulator. I tried to download the source code of KSOAP to debug in the failing methods, but was unnable to do compile ok on Eclipse.

    I really am stuck at this point. Please, any help would be great.

    Thank you in advance.

    Ok. Further reading took me to the problem.

    AFAIK, there are 5 ways to connect to web addresses from a BlackBerry device.

    Of course, the BB Simulator uses one that works with my WS. When my BB is connected via wifi it works as well. However, when I use the 3g from my device connection, I should mention the destinies of correct connection on the connection URL parameters.

    That's what I did:

    I read this: 1 Source

    And this (Spanish): Source 2

    Of course, I noticed that my BB is connected to a BES company, I must indicate the correct ConnectionUID to my address book of device on the connection string. So now the line in my code is:

    HttpTransport ht = new HttpTransport("http://www.address.com/service1.asmx;deviceside=false;ConnectionUID=YOURCONNECTIONUID");
    

    To find your UID connection, take your device, go to Options - Advanced Options - service book. Choose a book of service applications that connects successfully on your device (in my case Blackberry Internet Browser service), open it and copy the ConnectionUID. Then, paste it in the connection string.

    Now, it works great!

    My next challenge is to find connection string parameters correctly so that the application works on any device, not only on my ones company BES.

    Someone knows what should be the standard setting?

    I hope that my help of inquiry.

    P.S. still cannot complete successfully ServiceConnectionMidp...

  • Touch area does not work in the Simulator controller

    Hello!

    I use the bb Device Simulator.

    Official documentation says that with touch area to the Simulator controller I can navigate from control to control my fi application, I put political correct ficuse for her. But the touch area does not work for me. No event is occure when I do drag and hold the cursor of the mouse on the tactile area, or classic Simulator, not different mouse buttons.

    Tested under Windows 8.1 and Debian Linux with Xorg + awesome wm (and Xorg + mate of).

    How to solve this problem?

    Thank you!

    I tried this using the BlackBerry 10.3.2 Simulator and it worked.  At startup, you choose the default option no 1440 x 1440 Passport?  The Passport is the only BlackBerry 10 smartphone that supports active touch keyboard.  If you use the default startup in Simulator (Z10) the touchpad option does not work because it is not supported by this model.  To change the type, press ENTER when the Simulator starts first.

  • My App works on the Simulator, but not on a handheld

    Using the JDE 4.5 with 4.1.2 MDS Simulator

    Eclipse with JDE

    ---

    My app works fine on the simulator using MDS.

    The application simply pushes a screen and then creates a thread (an object of type LoadScreenThread) that will take an XML file using HTTP.  The XML file is parsed and then creates a new screen and it grows by calling (from LoadScreenThread): invokeLater with an executable object what method run() calls anti-pop and the specified UiApplication pushScreen.

    I tried various things for the last 10 hours and it still does not work.

    For the HTTP connection, because I would use MDS to Internet I added the '; '. deviceside = false' suffix.

    Could someone tell me please know why it would work fine on the Simulator (MDS) and not on a portable device?

    On the handheld, I see the arrows download flicker.  But it drives not only the new screen?

    Your device is connected to a MDS (BlackBerry Enterprise Server)?

    If it's just your BB private, so it's rather unlikely, and you will very probably connected to BIS. But you have to grant special permissions to RIM using BIS to use other means like the WAP2 gateway.

    Take a look at this thread:

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=29103

    It explains basically everything on the sides of the network connectivity to BlackBerry.

  • BlackBerry Webworks App does not work on the Simulator after conditioning

    Hi everyone, I ' ve developed a webworks app and everything works fine on the emulator ripple, but when I load it on the Blackberry (9860 and 9930) Simulator... it loads successfully (I can see the icon, etc.), but when I open it, appears only a WHITE SCREEN...!

    I thought it was the Blackberry Simulator, so I changed it (does not work)

    I thought it was my application, so I leave my fair "index.html" with a BLACK background (does not work)

    the Validation of my config.xml file is fine, and I have not any idea on how to solve this problem!

    Help please, thank you

    http://mundourbanohn.com/Simulator1.jpg

    Hello, thanks for people, but I already solved this problem, I had a div with POSITION: FIXED; and apparently WebWorks does not support this CSS property, so I removed it and everything works fine. Thanks in any case. Concerning

  • Help: Networking does not work on the Simulator

    Hello

    I downloaded all the versions of the Simulator, until the last 4.7 which has the storm, but for some reason networks do not seem to work on my Simulator. I checked the coverage of the network, said all this coverage is enabled but I am not able to use the browser to go anywhere. Could point out you what I did wrong please?

    Thank you

    got it works by MDS manual start as you suggested. Thank you all, it's a giant step for me, now I can get out of my cave and be connected to the world of my Simulator what a feeling!

  • Http method Post is not working in the Simulator (SDK 7.0) and not in the device with BB 5.0

    I am a novice in the development of BB.

    I tried to implement a simple Http Post request, but when running it in the Simulator (SDK 7.0), he gave an IOException.

    I've first implemented the Http Get request and was getting the same error but that was resolved by adding "; deviceSide = true'on demand.

    But while making the Post request parameters(username and password) were supposed to be written to outputstream open after successfully HttpConnection. I get the answer I used to get when I send two parameters as null.

    But the app even when built against JRE 5.0 crashes.

    Hi simon, peter

    I made changes to my connection as as well as u say it, but still no idea if I am wrong, if I do one.

    Now without using any suffix his run on my device but same answer as it was a GET request.

    A modified version of class ServerConnection (in post above)

    package com.httppostdemo.classes;
    
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    
    import javax.microedition.io.HttpConnection;
    
    import net.rim.device.api.io.transport.ConnectionDescriptor;
    import net.rim.device.api.io.transport.ConnectionFactory;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Dialog;
    
    public class HttpPostConnection extends Thread {
    
        private String mUrl = null;
        private byte[] mParams = null;
    
        public HttpPostConnection(String iUrl, byte[] iParams) {
            mUrl = iUrl;
            mParams = iParams;
        }
    
        public void run() {
            super.run();
            ConnectionFactory connectionFactory = new ConnectionFactory();
            ConnectionDescriptor connDescriptor = (ConnectionDescriptor) connectionFactory
                    .getConnection(mUrl);
            HttpConnection connection;
            OutputStream outStream;
            InputStream responseData;
            final ByteArrayOutputStream baos;
            int responseCode;
            int bytesRead;
    
            if (connDescriptor != null) {
                try {
    
                    connection = (HttpConnection) connDescriptor.getConnection();
                    connection.setRequestMethod(HttpConnection.POST);
                    connection.setRequestProperty("Content-Type",
                            "application/xwww-form-urlencoded");
                    connection.setRequestProperty("Content-Length",
                            String.valueOf(mParams.length));
    
                    outStream = connection.openOutputStream();
                    outStream.write(mParams);
                    outStream.close();
    
                    responseCode = connection.getResponseCode();
                    if (responseCode != HttpConnection.HTTP_OK) {
                        connection.close();
                        return;
                    }
    
                    baos = new ByteArrayOutputStream();
                    responseData = connection.openInputStream();
                    byte[] buffer = new byte[10000];
                    bytesRead = responseData.read(buffer);
                    while (bytesRead > 0) {
                        baos.write(buffer, 0, bytesRead);
                        bytesRead = responseData.read(buffer);
                    }
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                        public void run() {
                            Dialog.alert(new String(baos.toByteArray()));
                        }
                    });
                    baos.close();
                    connection.close();
    
                } catch (final Exception e) {
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                        public void run() {
                            Dialog.alert("Exception :: " + e.getMessage());
                        }
                    });
                }
    
            }
        }
    
    }
    
  • Sample Barcode Scanner does not work in the Simulator?

    Hi all

    I found barcode scanner sample code below link

    https://developer.BlackBerry.com/Cascades/sampleapps/

    Is this sample will be in the Simulator works or not?

    Tried what? The Simulator doesn't have a camera, so barcode scanner works in it. There is not much you can do.

  • GPS works on the Simulator, but not on phone

    Hello

    I created a simple application that gets the location of the device's GPS. The app works perfectly on the Simulator, but I have no GPS updates on the phone. I've been in options-> device-> Location.Settings on the phone and can see the GPS updates are coming through. But the app says there is no valid received GPS.

    I tried it on BlackBerry 9800... All I get on the phone is 'pending GPS update', that my app is displayed if no valid GPS don't trouble is received.

    Thanks in advance.

    Kevin

    C criteria = newCriteria();

    c.setHorizontalAccuracy (Criteria.NO_REQUIREMENT);

    c.setVerticalAccuracy (Criteria.NO_REQUIREMENT);

    c.setCostAllowed (true);

    c.setPreferredPowerConsumption (Criteria.POWER_USAGE_HIGH);

    LocationProvider lp;

    Try

    {

    LP = LocationProvider.getInstance (c);

    if (lp! = null)

    {

    lp.getLocation (timeout);

    lp.setLocationListener (newMyLocationListener(),-1, 1, 1);

    }

    on the other

    {

    Dialog.Alert ("sorry - your phone does not support GPS");

    }

    }

    catch (Exception e)

    {

    System.

    Err.println (try ());

    }

    }

    private class MyLocationListener implementsLocationListener

    {

    public voidlocationUpdated (LocationProvider provider, a place)

    {

    if (location! = null& location.isValid ())

    {

    QualifiedCoordinates qc = location.getQualifiedCoordinates ();

    Try

    {

    Lat string = Double.toString (qc.getLatitude ());

    String long = Double.toString (qc.getLongitude ());

    UpdateScreen ('place of registration successfully');

    }

    on the other

    {

    UpdateScreen (' Failed to day location ');

    }

    }

    catch (Exception e)

    {

    }

    }

    on the other

    {

    UpdateScreen ("waiting for GPS update");

    }

    }

    public void providerStateChanged (LocationProvider provider, intnewState)

    {

    TODO: If the provider has been disabled, then disable the reporting

    }

    }

    Try the examples of programs that you can find here:

    http://supportforums.BlackBerry.com/T5/Java-development/BBM-shareContent/m-p/1796237#M203486

    or here:

    http://supportforums.BlackBerry.com/T5/Java-development/simple-location-API/Ta-p/1145951

    See if these work on the unit.  If they do, look at the code listed and compare with yours.

  • Play video works on the Simulator, but not on phone

    Hello

    I created a simple application that plays a video of Media Card. It works very well and play the video properly on simulators. But when I loaded the app on the phone (BB Bold), it shows just a white screen and no video.

    The media file is in the following path on the map:

    / Media Card/BlackBerry/videos/I66.3GP

    The path should be:

    file:///SDCard/BlackBerry/videos/I66.3gp

    OR

    file:/// Card/BlackBerry/videos/I66.3GP Media

    Any suggestions on how to get it to work on the phone?

    class final VideoScreen extends form {}
    Private player player;
    private VideoControl vc;

    {VideoScreen()}
    try {}

    Reader = Manager.createPlayer ("file:///SDCard/BlackBerry/videos/I66.3GP");
    Player.Realize ();
    VC = player.getControl ("VideoControl") (alarm);
    vc.initDisplayMode (VideoControl.USE_DIRECT_VIDEO, this);
         
    GUIControl gc;
    If ((gc = player.getControl ("GUIControl")) (GUIControl)! = null)
    Add ((Field) gc.initDisplayMode (GUIControl.USE_GUI_PRIMITIVE, null));
    vc.setDisplayLocation (15, 15);
    vc.setDisplaySize (400, 400);
    vc.setVisible (true);
    Player.Start ();
      
    } catch (Exception e) {}
    }
    }

    Problem solved! It turns out that the "IoException: cannot access the media file" is because the BB is hooked up to the computer via USB, apprently Media Card is not available when USB is plugged.

    However, when USB is removed, I get this error:

    java.lang.IllegalArgumentException: arg must not be null and must be a javax.microedition.lcdui.Canvas

    It turns out that the audio/video tutorial of BB is incorrect, initDisplayMode cannot accept "GUIControl", he cannot accept that the canvas. In addition, if we directly on canvas without instantiate, it will be also caused an IllegalArgumentException.

    Then, the following code works:

    VideoControl vc;

    Canvas canvas = new MyCanvas ();

    If ((vc = player.getControl ("VideoControl")) (alarm)! = null) {}

    vc.initDisplayMode (VideoControl.USE_DIRECT_VIDEO, canvas);

    vc.setDisplayLocation (15, 15);

    vc.setDisplaySize (400, 400);

    vc.setVisible (true);

    Player.Start ();

    }

    While (MyCanvas) is a dummy class that extends from javax.microedition.lcdui.Canvas

    Import javax.microedition.lcdui.Canvas;

    import net.rim.device.api.ui.Graphics;

     

    MyCanvas class extends Canvas {}

    public

     

    public MyCanvas() {}

    }

     

    Protected Sub paint (javax.microedition.lcdui.Graphics arg0) {}

    / / TODO Auto-generated method stub

    }

    }

  • Event Swipe works in the Simulator, but not on the device

    I'm using panels on my 9900 and I have 4 panels that the user will slide back and forth similar functioning BB app world, changing the summary of comments on signs etc..

    My expection who was up and down for scanning of touch screen functions and the touchpad has the same function by default, that is to the left and right slide on the screen should also be identical to forehand and left on the block to tack. But it does nothing for the panels when you use the trackpad.

    So I replace NavigationMovement and and can see the touchscreen and the track pad to generate a NavigationMovement event with +/-x according to the direction slide. So I'm first puzzled why hit swiping the trackpad on the left and right triggers not the same behavior by hitting swiping left and right on the touch screen.

    Accept that as a limitation of the API, I added my own features to NavigationMovement to inject a key event when user left or right on the trackpad moves. As follows:

    EventInjector.TouchEvent [] moveEvents = new EventInjector.TouchEvent [7];

    moveEvents [0] = new EventInjector.TouchEvent (TouchEvent.MOVE, 420, -1, -1, 60-1);
    moveEvents [1] = new EventInjector.TouchEvent (TouchEvent.MOVE, 360, 60,-1, -1, -1);
    moveEvents [2] = new EventInjector.TouchEvent (TouchEvent.MOVE, 300, 60,-1, -1, -1);
    moveEvents [3] = new EventInjector.TouchEvent (TouchEvent.MOVE, 240, 60,-1, -1, -1);
    moveEvents [4] = new EventInjector.TouchEvent (TouchEvent.MOVE, 180, 60,-1, -1, -1);
    moveEvents [5] = new EventInjector.TouchEvent (TouchEvent.MOVE, 120, 60,-1, -1, -1);
    moveEvents [6] = new EventInjector.TouchEvent (TouchEvent.MOVE, 60, 60,-1, -1, -1);
    EventInjector.TouchEvent.injectSwipeGesture (480, 60, moveEvents);

    It works perfectly in the Simulator, but on the device, there is no movement at all. So I thought that maybe the touchpad on the Simulator is more sensitive than on the real device, so I added a menu item to perform the injection above. Again, this works perfectly on the Simulator, but nothing on the device.

    Has anyone tried this brain left and just before the injection?  Up and down the injection works perfectly on the device.

    Have you enabled event injection in request permission settings for your application?  It is disabled by default.  You can do so by going to Options-> Application, select your application and click on change permissions.  You can also request these permissions programmatically using the class ApplicationPermission.

  • Send message or e-mail using the Simulator

    are there opportunities that we can send an email or a msg using Simulator?

    Can of course.  Have a look here:

    Send and receive e-mail messages via the simulator of BlackBerry email offline server

    http://supportforums.BlackBerry.com/T5/testing-and-deployment/send-and-receive-email-messages-throug...

  • my world event working on the Simulator, but not on the device

    Hi guys,.

    I'm using BB bold 9000. I have attached directly to the device and debugging. I'm getting "background switch detected for myapp (261) that does NOT have the tunnels open - defocus is NOT called" on the device debugging. but it works fine on the Simulator (my ultimate task is slaughtering an application from another application) any idea?

    Thank you

    Thank you guys, it's worked.

Maybe you are looking for

  • More than six and still have not had a problem of fix from apple

    I called apple more than six weeks bc my son's phone has been hacked and lost mode. It has never been fixed and they keep telling me that technical support deals with it. ! I pay over $ 100 for her phone and he has not used in six weeks. How is this

  • Ability of the iPod

    I was told my IPod would hold about 10,000 songs and it is full with only about 7 200 What I am doing wrong and how to fix it?

  • To change the user name

    I'm changing my name and want to change my username.  If anyone can help with this?  I can't find.  He came in my mail from apple and I've looked everywhere I can think of to change. Thank you Teresa

  • password forgotten on my hp7 slate 16 GB

    Hi, I received my hp slate 7 model number ias 16 GB 4601. product no is f2h83aa #abu.  for Christmas, I set it up, then decided to put a password I don't have to write it by mistake now I forgot it can you please tell how can I reset it back factorys

  • Best practices para FC

    Senhores,Someone knows some best practices document aqui para configuracao ambiente com SAN storage CF? Em especial sober zoneamento?Aqui no trabalho we have some performance problems, travamentos e perdas caminhos back is hosting some LUN com e susp