SocketConnection

Hello, everyone. First of all, I would like to say thanks to this forum and the guy who gave us useful information. Here are some problems I encountered during my work. It's a socketConnection between the device and the server.

Firstly the device read the full book for the information of the connection. then according to this information, the application send data to the server and the response from the server. and according to the response from the server, the application returns information

In addition, I work with the JDE 5.0. and the same application is fine in the 9500 (4.7), but not in the 8900 (5.0) for the part of socket without wifi connection. If I use the wifi, the app will well on the 4.7 and 5.0.

Here's the order we do:

BIS-B: not ok. the response from the server once but the second time the application cannot get data from the server. After 2 minutes, it's time

MDS: not found

Unite: not found

WAP2.0: not ok. the server sends the response to the device the first time but not the right answer for the application to continue.

Direct TCP: ok with the difinition of the AFN

WiFi: ok

For the above test, it's under the 8900 (5.0), and I use SFR France service.

Thanks very in advance, this problem has feazen me to about two weeks.and sorry for my English. Any information will be appreciated. I hope you all spent a nice weekend. Please help me.

Lucas

I don't think that the connection string you provide is correct.

Please refer to the documentation provided with the approval of BIS - B, to correct the connection string you should use BIS - b.

With regard to the WAP, to test your network WAP, you must use the Vodafone Live browser (which is a WAP browser).  The first time that use you it, it you probably will prompt for more information.  I wonder if it's causing you problems WAP.  So launch the WAP browser, use it, make sure you tell him NOT to optimize traffic if you are prompted, and after doing this, I suspect that the processing of your WAP can work.  Just a hunch.

Tags: BlackBerry Developers

Similar Questions

  • Complete closure SocketConnections correctly

    Hello

    I'm having a problem with a persistent socket connection don't close does not correctly (at least I think that's the problem). Here is my scenario:

    I have an iPad, which has an application that listens to incomming socket connections and responds to the need (I'm not in control of this application). Then I on the side of BB. The general idea is, I try to open a connection on WiFi, a specific IP address. If this succeeds, I opened an InputStream and an OutputStream. Some messages are sent back and forth between the two devices (starting with a reading on the River - from the perspective of BB), and then wait for us. The iPad or BB can then initiate communication more. When it does not, the two are pending. Water courses are never closed, unless the BB or iPad outputs, in which case both are closed, as well as the connection.

    My problem is the following: if I close the BB app and off the device (i.e. ensuring that the app is completely closed and not only out of focus), then the next time I want to create a connection, it is just forever. Socket error (IOException), I get a general after about 30 years. I have to restart the iPad and try again to make it work again. So it seems that the BB is not completely close the connection, or the iPad is not clean properly. As I am not in control of the iPad code, I can't confirm. However, I think that it is on the side of BB as there is an iOS and Android version of my BB application, and they do not have this problem.

    I also noticed that I get the message (s):

    Background switch detected for APP_NAME (241) which has called id = 1mode FG = open - solomode DO NOT tunnel

    Background switch detected for APP_NAME (241) which has 1 tunnel (s) open - defocus called

    When I close the application on the BB.

    I use the following code to close the water connections (and make sure that this is called when the application stops):

    try {
                    if (inStream != null) {
                        inStream.close();
                        inStream = null;
                    }
                } catch (Exception e) {
                    System.out.println("Error closing instream: " + e.getMessage());
                }
                try {
                    if (outStream != null) {
                        outStream.close();
                        outStream = null;
                    }
                } catch (Exception e) {
                    System.out.println("Error closing outstream: " + e.getMessage());
                }
                try {
                    if (connection != null) {
                        connection.close();
                        connection = null;
                    }
                } catch (Exception e) {
                    System.out.println("Error closing connection: " + e.getMessage());
                }
    

    Another thing to note: I do things in the synchronized blocks, during the opening and closing of connections. I do also all the networks on a separate Thread. I make sure that all exceptions related to this to ensure that connections are closed. The connection, water courses and outstream instances are variable class.

    In a main loop, in the non-Main-Event-Thread, I check if the connection is closed, in this case, I wait a few seconds (Thread.sleep), then try opening the connection again. So I'm constantly returning the IP address.

    If I ever close the simulator/device and the connection seems to be able to connect/disconnect perfectly, with both applications open, then all closed and opened again, etc.

    Is there something I should be aware of the wrt completely closing Sockets, clean it properly, using blocks in sync, etc. ?

    I opened the connection as (all this surrounded by the try/catch/finally block and a synchronized block):

                   connection = (SocketConnection) Connector.open("socket://" + url + ";interface=wifi", Connector.READ_WRITE, true);
                    inStream = connection.openInputStream();
                    outStream = connection.openOutputStream();
    

    Thank you very much!

    P.S. I've been Googling/search forums since last week, and did not close - I hope that I have not missed anything.

    I think I might get a little. I can't believe that I don't check this before. I've installed wireshark to check what WAS going through, etc. I noticed that very little was coming or going to the iPad (even though he could browse the web, etc.). So I tried to make a simple ping of my machine. Nothing. WHAT? So I rebooted the iPad. It worked again... and then stopped? So I rebooted the router... He continued to work. And work... And work...

    Without doubt, it stops again. But it seems that there may be nothing wrong with the iPad or BB at all. It could just be something questionable with my router! I have... Can't... Believe not!

    I will continue to look into it and watch what is happening... but in the meantime, I'm terribly sorry for wasting your time! * so embarrassed *. Thanks for your help.

    PS, I know this isn't the place for this, but if anyone has any ideas as to why this can happen, I would be very grateful to know. It cost me a few days of time wasted dev.

  • Problem with SocketConnection 3G

    Hi all

    I'm stuck with a problem related to socket connections.

    WIFI I opens a connection socket with the following line:

    SocketConnection connection = (SocketConnection) Connector.open("socket://212.107.31.2:2299;deviceside=true;interface=wifi;");
    

    As expected, the line returns an object of type net.rim.device.cldc.io.tcpsocket.TcpClientConnection on which I can open InputStream and OutputStream without problems.

    With disabled WIFI, I use the following line to retrieve a socket in 3G connection:

    SocketConnection connection = (SocketConnection) Connector.open("socket://212.107.31.2:2299;deviceside=true;");
    

    Is where it gets weird as now an object of type net.rim.device.cldc.io.devicehttp.ClientProtocol is returned instead of the expected TcpClientConnection. Open an InputStream on the ClientProtocol translates an EOFException, the stacktrace:

    [0.0] EOFException
    [0.0] No detail message
    [0.0] net_rim_os-3(4BE21A1D)
    [0.0]  Utilities
    [0.0]  receiveLine
    [0.0]  0xBAEC
    [0.0] net_rim_os-3(4BE21A1D)
    [0.0]  StatusLine
    [0.0]  readFromStream
    [0.0]  0xA480
    [0.0] net_rim_os-2(4BE21A1D)
    [0.0]  ClientProtocol
    [0.0]  readResponse
    [0.0]  0x16DE
    [0.0] net_rim_os-3(4BE21A1D)
    [0.0]  HttpProtocolBase
    [0.0]  transitionToState
    [0.0]  0x4120
    [0.0] net_rim_os-3(4BE21A1D)
    [0.0]  HttpProtocolBase
    [0.0]  openInputStream
    [0.0]  0x44B4
    [0.0] net_rim_os-3(4BE21A1D)
    [0.0]  HttpProtocolBase
    [0.0]  openDataInputStream
    [0.0]  0x44F0
    [0.0] socket_test(4A71D639)
    [0.0]  SocketThread
    [0.0]  
    [0.0]  0x65DE
    [0.0] socket_test(4A71D639)
    [0.0]  SocketThread
    [0.0]  run
    [0.0]  0x46FE
    

    BTW, in case you are wondering I have a plan of comprehensive data including direct TCP, and I can confirm that when I use the sim card from my Android phone.

    What I am doing wrong? Any help is appreciated!

    Thank you

    Emma

    Details: Platform 6.6.0.212, App Version 6.0.0.570, Curve 9300, Vodafone carrier device

    I would like to delete the final semicolon from here:

    deviceside = true; ») ;

    and do the same for WiFi.

    If you use deviceside = true, you must have put the APN settings for your carrier in the TCP Options on your device.

    I would also like to be a little careful with the Port.  I have not be able to connect on something other than standard ports (80 and 443) when using socket above the carrier provided network TCP connections.  Try what you do with a server listening on port 80 and see if it works.  Then move it to 2299.

  • 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.

  • SocketConnection packets TCP 1 byte

    I encounter strange behavior when using SocketConnection. I use JDE 4.6.0 and you encounter the problem on a "Bold" 4.6.0.185 OS as well as the OS 4.6.0.216.

    When sending a string/bytes on a SocketConnection device sends each byte as a single TCP packet. Is this a bug in the OS or I do something wrong?

    My code looks like this (Simplified):

      public void connect() {      sendThread = new SendThread();      sendThread.start();
    
          connectionThread = new ConnectionThread();      connectionThread.start();  }
    
      public void send( String data ) {    /* put data into sending queue */  }
    
      public class ConnectionThread extends Thread {      public void run() {          SocketConnection connection = (SocketConnection)Connector.open( "socket://" + host + ":" + port + ";deviceside=true;interface=wifi;ConnectionTimeout=1800000" ); 
    
          InputStream readerStream = connection.openInputStream();      OutputStream writerStream = connection.openOutputStream();
    
          // put some data into sending queue      send( " version='1.0'>" );
    
          while( true ) {        readerStream.read();      }    }  }
    
      public class SendThread extends Thread {      public void run() {            while( true ) {        for( /* sending queue */ ) {          _send( data );        }      }    }
    
        private void _send( String data ) {            byte [] encodedBuffer = null;          try {            encodedBuffer = xmpp.getBytes("UTF-8");          } catch( UnsupportedEncodingException e ) {            encodedBuffer = xmpp.getBytes();          }        }
    
            try {          writerStream.write( encodedBuffer );          writerStream.flush();        }        catch(IOException e)        {        }       }    }  } 
    

    I don't change any SocketStream options. Access to the file sending is correctly synchronized. Reading in the ConnectionThread is more sophisticated and actually consume the data.

    That's what I see on the network. Using another (Windows) client to connect to the server works properly, so this isn't a problem with the server.

    root@Debian-40-etch-32-minimal: ~ #.

    signature ngrep w - q r the 76.110.XX host. XX and port 5222
    Interface: eth0 (85.10.193.64/255.255.255.224)
    filter: (ip or ip6) and (76.110.XX the host. XX and port 5222)

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    s

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    t

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    r

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    e

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    one

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    m

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    :

    (...)

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    .

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    0

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    '

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    >

    T 85.10.XX. XX:5222-> 76.110.XX. XX:55192 [AP]
    http://EtheRx.Jabber.org/streams"xmlns =" jabber client: "from =" host.com"id ="59649 b 8"XML: lang ="en"version ="1.0">"

    T 85.10.XX. XX:5222-> 76.110.XX. XX:55192 [AP]
    arams:XML:ns:XMPP - tls ">arams:xml:ns:xmpp - sasl" >DIGEST-MD5PLAINANONYMOUSCRAM-MD5SHAREDSECRET JIVEhttp://jabber.org/features/compress "' >zlib <> xmlns ="http://jabber.org/features/iq-auth "/ >: features >

    (actually two bytes * here seem to Miss! There should be"<' and="">

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    q

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    t

    T 76.110.XX. XX:55192-> 85.10.XX. XX:5222 [AP]
    There

    OK, so I found the problem :-)

    My code is actually oversimplified, and I left out an important part. I was not using OutputStream but instead to use a derived class, that I would spend the OutputStream of the connection.openOutputStream call.

    The problem with my derived class was that she only substitute write (int data) and do not write (byte [] data).

    What happens in this case, it's that the default implementation calls OutputStream.write (byte [] data) write (int data) for each single byte.

    The fix was also replace write (byte [] data) and call the write method (byte [] data) of the original stream.

  • SocketConnection / DataInputStream - 1 MB limit?

    Is there any type of restriction on the amount of data that can handle a DataInputStream?

    Use any type of connection (wifi, tcp, wap2) - and even on the Simulator - I appear to be limited to receive slightly more than 1 MB of data on a connection.    Note that the flow of connection / works great in all other ways.

    If I use readData (byte []...) or char c = readData() the result is the same: shortly after I hit the 1 MB mark, he starts blocking as if there is no data to receive (every indication so far is that it is - for example, this may occur when you view a long log file.

    Someone saw something similar, or have any suggestions?  A forum search showed a possible match (large file transfer does not complete) but no solution.

    Edit: Oops - almost forgot to add.  In the debugger, I see that just before the start of the block, I get less data that may contain buffer memory.  Even if there should be enough incoming to fill.

    Looks like responses - Telnet Protocol worked, I could receive 10 + MB without any problem.

    Given that both use the same types of socket connection in the client, the default should be something done (or not done) in the implementation of the SSH client.

    Thank you for the responses, anyway – has helped keep me thinking two

  • Tunnel failed... :(

    Hi guys...

    I am facing problem connecting...  I run server and client on the same system his job very well.

    but when I run the server on the network and the client on any other machince, there's the message came on the client side when connecting...

    "Tunnel failure.."

    even I have check the network and do try to systems boths ping them no problem Ping.

    See that's my Server Code located in J2se

    providerSocket = new ServerSocket(2000);
    
    System.out.println("Waiting for connection");
    
    connection = providerSocket.accept();
    
    System.out.println("Connection received");
    
    //3. get Input and Output streams
    
    out=new DataOutputStream(new BufferedOutputStream(connection.getOutputStream()));
    
    in=new DataInputStream(new BufferedInputStream(connection.getInputStream()));
    do{
       try{
        byte b[]=new byte[1024];
        in.read(b);
        message = new String(b);
        if(message.equals("501"))
        sendMessage("hello some message");
        else
        sendMessage("601");
        System.out.println("client>" + message);
        }
        catch(Exception ex){
        System.err.println("Exception in do while : "+ex.getMessage() );
        }
      }while(!message.equals("bye"));
    

    This is the code running on blackberry client-side...

    Try

    requestSocket = (SocketConnection) Connector.open("socket://176.249.0.17:2000;deviceside=true", Connector.READ_WRITE);
    
  • Problems with GZip &amp; FTP

    Hello

    in my application, I need to send a file compressed using ftp.

    To do this, I used a class initially write to use with J2SE (SimpleFTP)

    I have change for use with RIM API and it work with file bit compressed (like 4 KB) but when I try to send one just a little big (12Ko) I have a problem to decompress: gzip - me to say end of file unexpected.

    It is a bit of cod used:

    //In a thread i create the connection and change to BIN
    ftp.connect(ip, port, user, psw, true, apn, apnUser, apnPsw);
    ftp.cwd(dir);
    ftp.bin();
    
    //here I obtain a csv representation of my object and store it in a //String var
    String csv = r.toCSV();
    
    //this method ask to ftp object to store a ByteArray in the file named //file and i want to zip it and return true if all is ok
    if (ftp.stor(new ByteArrayInputStream(csv.getBytes("UTF-8")),file,true))
    //...do things
    

    the method of object ftp stor have this code:

    /**
     * Sends a file to be stored on the FTP server. Returns true if the file
     * transfer was successful. The file is sent in passive mode to avoid NAT or
     * firewall problems at the client end.
     */
    public synchronized boolean stor(InputStream inputStream, String filename, boolean zipped) throws IOException {
    
        sendLine("PASV");
        String response = readLine();
        if (!response.startsWith("227 ")) {
            throw new IOException("SimpleFTP could not request passive mode: " + response);
        }
        String ip = null;
        int port = -1;
        int opening = response.indexOf('(');
        int closing = response.indexOf(')', opening + 1);
        if (closing > 0) {
            String dataLink = response.substring(opening + 1, closing);
            String[] tokenizer = Functions.splitString(dataLink, ',', -1);
            try {
                ip = tokenizer[0] + "." + tokenizer[1] + "." + tokenizer[2] + "." + tokenizer[3];
                port = Integer.parseInt(tokenizer[4]) * 256 + Integer.parseInt(tokenizer[5]);
            } catch (Exception e) {
                throw new IOException("SimpleFTP received bad data link information: " + response);
            }
        }
        String url = "socket://" + ip + ":" + port + urlParam;
        Logger.log(this, "Try to open passive connection to "+url);
        SocketConnection dataSocket = (SocketConnection) Connector.open(url);
        dataSocket.setSocketOption(SocketConnection.LINGER, 5);
        dataSocket.setSocketOption(SocketConnection.DELAY, 5);
    
        sendLine("STOR " + filename);
    
        response = readLine();
        if (!response.startsWith("125 ")&&!response.startsWith("150 ")) {
            dataSocket.close();
            dataSocket=null;
            throw new IOException("SimpleFTP was not allowed to send the file: " + response);
        }
        Logger.log(this, "Connected to "+url);
    
        OutputStream output;
        if (zipped)
            output = new GZIPOutputStream(dataSocket.openOutputStream(),GZIPOutputStream.COMPRESSION_BEST);
        else
            output = dataSocket.openOutputStream();
    
        byte[] buffer = new byte[512];
        int bytesRead = 0;
    
        while ((bytesRead = inputStream.read(buffer)) != -1) {
            output.write(buffer, 0, bytesRead);
        }
    
        output.flush();
        output.close();
        output = null;
        dataSocket.close();
        dataSocket=null;
    
        response = readLine();
        return response.startsWith("226 ");
    }
    

    The readline() and sendline("") methods read or write to the ftp decision-making, a line ended with CR and I so need to send FTP commands

    I think that everything is ok, for this problem I find in a forum that the problem will be the use of ASCII in FTP method, but I change to BIN

    Any idea?

    Thank you in advance!

    Hello

    Finally, I solved the problem.

    I find the solution in the documentation GZIPOutputStream

    You must pass OutputStream to GZIPOutputStream, zipping it and then you must close GZIPOutputStream but you must use the original OutputStream.

    So in my SimpleFTP class I have to write about gzip, close it then flush() and close() the original outputstream.

    Knit

    I had the new method of stor() here to see

    /**
         * Sends a file to be stored on the FTP server. Returns true if the file
         * transfer was successful. The file is sent in passive mode to avoid NAT or
         * firewall problems at the client end.
         */
        public synchronized boolean stor(InputStream inputStream, String filename, boolean zipped) throws IOException {
    
            sendLine("PASV");
            String response = readLine();
            if (!response.startsWith("227 ")) {
                throw new IOException("SimpleFTP could not request passive mode: " + response);
            }
    
            String ip = null;
            int port = -1;
            int opening = response.indexOf('(');
            int closing = response.indexOf(')', opening + 1);
            if (closing > 0) {
                String dataLink = response.substring(opening + 1, closing);
                String[] tokenizer = Functions.splitString(dataLink, ',', -1);
                try {
                    ip = tokenizer[0] + "." + tokenizer[1] + "." + tokenizer[2] + "." + tokenizer[3];
                    port = Integer.parseInt(tokenizer[4]) * 256 + Integer.parseInt(tokenizer[5]);
                } catch (Exception e) {
                    throw new IOException("SimpleFTP received bad data link information: " + response);
                }
            }
            String url = "socket://" + ip + ":" + port + urlParam;
            Logger.log(this, "Try to open passive connection to "+url);
            SocketConnection dataSocket = (SocketConnection) Connector.open(url);
            dataSocket.setSocketOption(SocketConnection.LINGER, 5);
            dataSocket.setSocketOption(SocketConnection.DELAY, 5);
    
            sendLine("STOR " + filename);
    
            response = readLine();
            if (!response.startsWith("125 ")&&!response.startsWith("150 ")) {
                dataSocket.close();
                dataSocket=null;
                throw new IOException("SimpleFTP was not allowed to send the file: " + response);
            }
            Logger.log(this, "Connected to "+url);
    
            OutputStream output = dataSocket.openOutputStream();
            byte[] buffer = new byte[512];
            int bytesRead = 0;
    
            if (zipped){
                GZIPOutputStream zipOutput = new GZIPOutputStream(output,6, GZIPOutputStream.MAX_LOG2_WINDOW_LENGTH);;
                while (!isAskForAbort() && (bytesRead = inputStream.read(buffer)) != -1) {
                    zipOutput.write(buffer, 0, bytesRead);
                }
                zipOutput.close();
            } else {
                while (!isAskForAbort() && (bytesRead = inputStream.read(buffer)) != -1) {
                    output.write(buffer, 0, bytesRead);
                }
            }
            if (isAskForAbort()){
                abor();
                output.close();
                output = null;
                dataSocket.close();
                dataSocket=null;
                try {
                    setAskForAbort(false);
                } catch (BbException e) {/*nothing to do. Here ftp is conected*/}
                return false;
            }
            output.flush();
            output.close();
            output = null;
            dataSocket.close();
            dataSocket=null;
    
            response = readLine();
            return response.startsWith("226 ");
        }
    

    Thank you much for the help.

  • Why can't I download Win 7

    I am trying to download under Firefox 3.0.10 and I get this:

    Java plug-in 1.6.0_11
    Using JRE version 1.6.0_11 Java hotspot Client VM
    User home directory = C:\Documents and Settings\Johnny
    ----------------------------------------------------
    c: clear console window
    f: finalize objects on the finalization queue
    g: garbage collection
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: Hide console
    r: reload the policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: delete the cache of class loaders
    0-5: set the trace level
    ----------------------------------------------------

    load: class com.akamai.dm.ui.applet.DMApplet.class not found.
    java.lang.ClassNotFoundException: com.akamai.dm.ui.applet.DMApplet.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass (unknown Source)
    at java.lang.ClassLoader.loadClass (unknown Source)
    at java.lang.ClassLoader.loadClass (unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode (unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet (unknown Source)
    to sun.plugin2.applet.Plugin2Manager$ AppletExecutionRunnable.run (unknown Source)
    at java.lang.Thread.run (unknown Source)
    Caused by: java.net.ConnectException: connection refused: connect
    at java.net.PlainSocketImpl.socketConnect (Native Method)
    at java.net.PlainSocketImpl.doConnect (unknown Source)
    at java.net.PlainSocketImpl.connectToAddress (unknown Source)
    at java.net.PlainSocketImpl.connect (unknown Source)
    at java.net.SocksSocketImpl.connect (unknown Source)
    at java.net.Socket.connect (unknown Source)
    at sun.net.NetworkClient.doConnect (unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown_Source)
    at sun.net.www.http.HttpClient.openServer(Unknown_Source)
    to sun.net.www.http.HttpClient. (Unknown source)
    at sun.net.www.http.HttpClient.New(Unknown_Source)
    at sun.net.www.http.HttpClient.New(Unknown_Source)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown_Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown_Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown_Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown_Source)
    the impossible (unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes (unknown Source)
    to sun.plugin2.applet.Applet2ClassLoader.access$ 000 (unknown Source)
    to sun.plugin2.applet.Applet2ClassLoader$ 1.run (unknown Source)
    at java.security.AccessController.doPrivileged (Native Method)
    ... 7 more
    Exception: java.lang.ClassNotFoundException: com.akamai.dm.ui.applet.DMApplet.class

    What should I do to fix this? I tried to install IE8, and who connects not even to the internet. If this is what I can expect in a potentially expensive piece of software, I think I'll stick with XP, or go to a kind of open source. I certainly hope that I can get a SIGNIFICANT discount if I do not always get work when I buy the real deal later (if I buy it)...

    have you tried with Explorer 7, Firefox to download the product microsoft... hmmmmm let me see.

  • Button Click event

    Hello

    I added a button on the screen of my Blackberry and I have a class called WebCall who has the Socket connection

    http://www.BlackBerry.com/developers/docs/7.1.0api/javax/microedition/IO/SocketConnection.html

    I want that when I click the button, it calls the WebCall class.

    How to archive this?

    Thank you

    Hamid Weiss

    Citing a treatment on a button click has been discussed on this thread:

    http://supportforums.BlackBerry.com/T5/Java-development/pushing-screen/TD-p/2399831

    In this case, you should be aware that the button click process runs on the event Thread.  But to make blocking as network activity operations, you must do this in your own Thread:

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

    http://supportforums.BlackBerry.com/T5/Java-development/blocking-operation-not-permitted-on-event-di...

    So, you need start a Thread to do the treatment on your network.  Processing on BlackBerry thread is quite similar to the standard Java Thread processing, so there is no specific documentation of BB for this, but you should a lot of samples of Java if you look around.

    According to the first link that I've referenced, I would recommend that you study the samples you will find.  They will never do exactly what you want, but while you are learning, it is better to start with a sample of work and make small changes to get to what you want, try to create everything from scratch.

    And you should make yourself familiar with this micro-site:

    http://developer.BlackBerry.com/Java/

    Good luck and have fun!

  • Problem with the drive of entry

    Hello

    I have a problem with the connections of socket on blackberry.

    I send a command to my server and it will answer me with something like

    WORM R1; ACT: 0; CLV: 1.0.0; PRO: 1.0.1; UID: carlsum@ociss

    SC = (SocketConnection)
    Connector.Open ("socket://fes.ngv-group.com:5080; deviceside = true");
    sc.setSocketOption (SocketConnection.KEEPALIVE, 5);
    is = sc.openInputStream ();
    OS = sc.openOutputStream ();
    OS. Write (Protocol.doVersion (UID). GetBytes());
    OS. Write (Protocol.doLogin (UID). GetBytes());
    int bytesAvailable = is.available ();<----returns a="" value="" of="">
    Char input [] = new char [bytesAvailable];
    for (int i = 0; i)< bytesavailable;="" ++i="" )="">
    input [i] = (char) is.read ();
    };

    However my contribution [i] array only contains v.

    Why is - this is.available line () returns 0?

    How to read in the range full of WORM R1; ACT: 0; CLV: 1.0.0; PRO: 1.0.1; UID: carlsum@ociss in my input array

    I agree that treatment work should you find.  I suspect that you have a coding bug.  Take a look at the folloing code.  The result was what I expected:

    test
    t
    e
    s
    t

    Byte [] testBytes = new byte [] {(byte) 0 x 74, (byte) 0 x 65, (byte) 0 73, (byte) 0 x 74 x};
    String testString = new String (testBytes);
    System.out.println (testString);
    Char [] testChars = testString.toCharArray ();
    for (int i = 0; i)< testchars.length;="" i++="" )="">
    System.out.println (testChars [i]);
    }

  • Transfer TCP on WiFi speed

    I am a direct Socket connection to a laptop on the same router (with the suffix "= wifi interface"). It works but the connection is incredibly slow, and the transfer of files is at a maximum rate of 24.5 KB/s.

    It may be related to the mechanism we use:

    Applications of BB 64K-->

    <-- laptop="" sends="">

    Applications of BB 64K-->

    ....

    But still, he cannot be so slow. I was wondering what advice you guys can give me.

    I tried the following:

    (1) reading the full 64 K at once,

    byte[] data=new byte[64000];in.read(data);
    

    (2) setting receive and send buffers

    socket.setSocketOption(SocketConnection.RCVBUF,64000);
    socket.setSocketOption(SocketConnection.SNDBUF,64000);
    

    (3) using a class for FileConnection and entry/OutputStreams variable so it is not open or closed for each package.

    What else did I miss?

    No, I was referring to the CRC code I implemented for my application (message layer).

    In addition, I was blushing the output stream each package which has become a bottleneck and caused the device to hang (as it is faster than the hot flashes in a local installation to receive a new package). Later, I'll let the OS worry about rinsing an OutputStream now.

    During the reception, I'm able to reach a speed of 250 + KB/s now.

    (Same Wi - Fi network)

  • Socket or Http

    HelloW...

    I have a guy to connect my application to internet I check first that its available interface... When I determined that the unit have put wifi «;» interface wifi = "or"; "device = true".

    buddy its in the beginning of the url I put

    http://XXXXXXXXX; Parameter or socket://xxxxxxxxxxx

    for example, I try whit http for wifi and the works, but here say that use the plug, so if use http its bad?

    and I have allways a port? in the docs, I see: 600

    http://supportforums.BlackBerry.com/T5/Java-development/different-ways-to-make-an-HTTP-or-socket-con...

    HTTP is a Protocol built on sockets. If you want to do a HTTP transaction (GET, POST, etc.), then you use http://... and when you create the connection, cast to an HttpConnection. If you're doing something else (streaming media or telnet, for example), then you don't use HTTP. You must use the socket: / /... and set up the connection to a SocketConnection.

    By default, HTTP port 80. By default, HTTPS uses port 443. Casings, however, generally do not have default ports and you specify one. Many ports have pre-defined uses; See, for example, http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

  • Difficulty in communicating through TCP BIS-B socket

    I have tries to establish a TCP via BIS - B connection and run into some problems.  Before describing the situation, I just want to clarify:

    -We are members of the BlackBerry Alliance program;
    -We have received permission to use BIS-B;
    -L'application now works under direct TCP. and
    -L' sample application supplied with the BIS-B information kit works well on the device.

    So, it seems that the camera has access BIS-B and that our application should be able to connect through BIS-B without difficulty.  Previously, I have forwarded this issue to the Alliance but has been achieved here for support, so I will briefly the question not to mention that all aspects of BIS - B covered under the NDA.

    Here's the situation:

    The connection string that I use to create a TCP socket in our program the device server is:
    Socket://IP_ADDRESS:TCP_SERVER_PORT; BIS_B_CONNECTION_STRING

    Where:
    Ip_address is the IP address of the server, the connection program is made for;
    TCP_SERVER_PORT is the TCP port; and
    BIS_B_CONNECTION_STRING is provided to access BIS-B connection string.

    As with direct TCP, the SocketConnection object is created:
    (SocketConnection) Connector.Open (connString, Connector.READ_WRITE);

    Where connString is the above connection string.  Once the connector is created, threads separate send and receive support are started.

    To connect to the server, a packet of 76 bytes of data is written to the socket with OutputStream.write (byte [] b, int off, int len) and rinse with OutputStream.flush ().  Data are received on the server without problem and a 32-byte ACK packet is sent to the server to the device subsequently.

    Here is where the problem appears: the client application on the device never receives the data sent from the server.  Even if the socket has been established and data can be sent on this socket of the device to the server, not a single byte sent from the server to the device is received by the device.  However, when you use TCP direct to establish awareness, data are transmitted between the server and the device without problem.

    This leads me to conclude that one or both of the following ways are produced:

    (1) I'm not creates the socket correctly for a BIS - B connection.

    The examples in the documentation for BIS - B are all for HTTP connections and no demo code is provided to show how a TCP socket should be created.  It is quite possible, there is a minor adjustment for the BIS-B connection string which I am unaware or I create the socket incorrectly.

    (2) my BlackBerry service provider incorrectly configured their BIS-B network connections.

    My device is connected to TELUS and the situation I am facing to sounds a bit like the one described by this man in 2008:

    http://supportforums.BlackBerry.com/T5/General-BlackBerry-smartphone/TELUS-confirmed-BlackBerry-bis-...

    Given that the problem occurs when the data is passed from the server to the device, it seems possible that the IP addresses of device are not properly being NATted on the public address that the server transmits data.  I called people of the TELUS DNA to confirm the BIS-B service is available, but (as the related post described), which does not necessarily eliminate the possibility of a misconfigured NAT.

    So my questions to you people are:

    -If a TCP server program receives data from a device via BIS - B, does indicate that the BIS - B has been correctly established (and so the problem of receiving data server-device is specific to the device or carrier)?

    -J' I am doing something obviously wrong when establishing a TCP via BIS - B socket?

    -Are there a required additional parameter in the connection string (beyond those provided by the HTTP BIS-B connection example) which creates a TCP via BIS - B socket?

    Cause of the problem proved to be the use of InputStream.available () to check the amount of bytes available to entrants on the socket.

    Although InputStream.available () worked well for direct TCP (at least for CDMA Networks), the method returns always 0 when it receives on BIS - B bytes.  As a result, it appeared that the side Server-device of the TCP socket was not receiving data when in fact, the data were available for playback.  With the help of InputStream.read () instead, block and read each byte it received on the socket has resolved the problem.  Given that the incompatible features, I would recommend avoiding the use of InputStream.available ().

    For all those looking at the creation of BIS-B TCP taken in the future, here an answer to my original question:

    The connection string to use to create a TCP socket BIS - B is the same as that shown in the code examples in the RIM for an HTTP connection (examples of code and your BIS - B connection string are received once approval has been given to use BIS-B under the program of the Alliance).

    For example, if your connection string to create a direct TCP socket would be:

    Socket://IP_ADDRESS:TCP_PORT; deviceside = true

    where ip_address is the IP address of your server TCP program and port_tcp is the network port on which traffic is received by the server, you need to replace only the "; deviceside = true' part of your connection string with the string supplied by RIM for your BIS - B connection.  The resulting string would then serve to create a standard TCP socket, such as the following:

    (SocketConnection) Connector.Open (connString, Connector.READ_WRITE);

    where connString is your ' socket: / /... ". ' connection string.

  • DataOutputStream HTTP Post rinse and segment the encoding problems

    Hello

    I'm finally back to the question that I had a few months ago, but I can't always solve this

    I used this article to understand how to upload files into pieces of a server: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800431/How_To _...

    Downloading is easy to implement, but I have problems with the download. I am trying to download a large file into smaller pieces. I tried different options. The one that works best is when I use DataOutputStream and write in there after each small party has been read from the file.

    But when I used the flush() function then he threw OutOfMemoryException()! But only if the file is quite large.

    An example of code:

    InputStream    is = (StreamConnection)Connector.open(url , Connector.READ_WRITE, true);
    HttpConnection c = (HttpsConnection)is;
    
    //set connection parameters
    c.setRequestMethod( HttpConnection.POST );
    c.setRequestProperty( "User-Agent", "MyUserAgent/0.2" );
    
    for( ;; )
    {   if( done ) break;
    
       //i have removed some reading code to simlify example
       out.write( bytedata  , 0 , bytesRead );
       Thread.yield();
    }
    
    out.flush();     //<-- OutOfMemory exception here!
    
    int result = c.getResponseCode();
    
    out.close();
    

    I found that I wasn't the only one to have this problem.

    1: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212479

    2: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5026745

    I usually have the same code, but only use HTTPConnection for this.

    The solution was to use "Chunked" encoding of the header and appellant hunting every time data is written to the output stream.

    However, it has not worked for me. If I use a stored block coding, I 'ConnectionClosedException' when flush() is used for the first time.

    Here is a code example:

    InputStream    is = (StreamConnection)Connector.open(url , Connector.READ_WRITE, true);
    HttpConnection c = (HttpsConnection)is;
    
    //set connection parameters
    c.setRequestMethod( HttpConnection.POST );
    c.setRequestProperty( "User-Agent", "MyUserAgent/0.2" );
    c.setRequestProperty( HttpProtocolConstants.HEADER_TRANSFER_ENCODING, "chunked" );
    
    for( ;; )
    {
       if( done ) break;
    
       //i have removed some reading code to simlify example
       out.write( bytedata  , 0 , bytesRead );
       Thread.yield();
       out.flush();     //<-- ConnectionClosedException
    }
    
    int result = c.getResponseCode();
    
    out.close();
    

    Here is a screenshot of the at the time of the exception stack trace:

    And here are the details of the exception:

    Now, I honestly don't know what to do next. I tried all sorts of options and choices, but can not get this to work for some reason to download any.

    Tried on BlackBerry JDE and Simulator 4.2.1

    Help, please

    Thank you.

    Thank you, but I think that this was not related to this problem.

    The solution is to use SocketConnection would work on writing data OutputStream and flush(). But only if the Content-Length is calculated with precision and this server application is also properly formatted.

    If there are errors in the POST request, the server would send a message back and ConnectionClosedException appear.

    The best way to resolve these issues is to get a sniffer package good as "Wireshark" and study all the packages with a lot of attention even a small typo can break everything.

    I have another question, but the download itself works with the function flush() as expected on the device and emulator. So I think this can be considered fixed.

Maybe you are looking for

  • Replacing the battery of Qosmio G30-204

    Hi people, the current battery I have takes about 10 minutes after full load.So, I think to replace. The battery I have right now is a PA3475U-1BRS. I can get my hands on a replacement but the model is:PA3476U-1BRS It is the same shape and everything

  • How to check a Svchost.exe high memory usage and troubleshoot?

    How to check a Svchost.exe high memory usage and troubleshoot

  • problems installing driver for trendnet 648ubm on Windows xp

    I installed the software for this adapter wireless instructions.  But although she is supposed to work with XP, when I try to use the adapter it does not work.  At first my computer has not found the driver (even though it had been installed and the

  • Mapi32.dll dependency issue of my App

    Hello I develop email sending component for my extended MAPI application that works together with Outlook, but I found that the app had dependence on mapi32.dll (under "C:\windows\system32"). I'm worried that my application can not be started, if the

  • How to uninstall avg 8.5 free edition

    I can't uninstall avg.8.5 free edition and download and install avg int. 2011 seconds. I get 2 errors on part of uninstall. but I want deleted.