Sharp GX15 (MIDP 2.0 without sockets!?!?)

Hi, im development for a Sharp GX15 (Vodafone), it has MIDP 2.0, but when i try to make a socket
connection it give me this error "ConnectionNotFoundException: The request protocol not exist socket://server:port".
I want know if really this mobile dont support sockets or if im doing something wrong (The code work
with other mobiles)
Someone know what mobiles with MIDP2.0 has not socket connection?
Thanks.

Hi Carlos,
I came across your post about Sharp GX15 development sw. I am very interested in testing a j2me game into it, I tried several times to pass on this game into the mobile through bluetooth but It always prompts with a "Wrong Data" message. I certainly don't know whether this message is because the game has some features (MIDP, CLDC...) the mobile doesn't support or because the mobile bluetooth is not aimed at passing games from the pc to the mobile.
As I saw you are experienced in developing software for this mobile you may know what's wrong.
Thank you in advance.
David

Similar Messages

  • How to install cldc/midp to phone without them?

    I'm a Java developer new to mobile java, working on a totally new project which is at the stage of deciding what phones to use and purchase for testing. I understand the concept of cldc/midp as a standard cross-phone platform but have the following very basic question: can you (or how do you) install these prereq's on a phone that doesn't have them initially when purchased? Is this a problem or a non-issue (perhaps you just load them as with Java jdk onto a desktop)?

    If I understand you right, you want to know how to add API:s ie MMAPI to a phone?
    Well thats impossible.. the only way you are going to get support for new api is if the manufacturar adds it in the next firmware (That never happends) . So if you buy a phone that is the tools you have.. Nothing els except the ones you write your self.
    Cheers
    Kenth Fagerlund

  • Multiple socket connections with MIDP

    dear experts,
    I have a simple problem and I hope someone can help me to solve it.
    I need to open a socket connection from multiple MIDlets on the same port.
    This error occours when I try to make a socket push registration from the second (or third, or fourth...) midlet (I'm able to connect to the socket correctly from the first midlet that makes a push registration):
    PushProcessor.run Exceptionjava.io.IOException: ServerSocket Open
    java.io.IOException: ServerSocket Open
         at com.sun.midp.io.j2me.serversocket.Socket.open(+39)
         at com.sun.midp.io.j2me.socket.Protocol.openPrim(+127)
         at javax.microedition.io.Connector.openPrim(+121)
         at javax.microedition.io.Connector.open(+15)
         at javax.microedition.io.Connector.open(+6)
         at javax.microedition.io.Connector.open(+5)
         at it.myprj.midp.BasicPushMIDlet$PushProcessor.run(+16)
    I would know if push registry API allows to have multiple connection on the same socket port.
    any help is appreciated!
    giovanni

    in my opinion,
    due to the fact when an app binds one port and a second app tries to bind the same (@same time) there will ever be a exception (from my point of view)!
    an no i think that push registry cant register two apps on same port (eg datagram://5060)
    hope this helps
    chris

  • Third party Messaging library for MIDP 1.0 phones

    Hi guys,
    Does anybody know any 3rd party library for MIDP 1.0 platform?
    Actually, I mean MIDP 1.0 without WMAPI.
    Thnx.

    there is a possibility (but the phone will not send the sms):
    send a text to a server, the server will send the sms and returns the status of the send!
    or decompile i-mode api to see how they did it!

  • Shots are all imported with sharpness +25% and brightness +50% :(

    Hi!
    That's boring, really, a have to remember to reduce brightness every time I import photos, for example in lightroom. Is there any way to get rid of that? Maybe someone knows where these settings are coming from? Is it possible that my camera (I got lumix DMC-FZ100 - no changable lens) writes them into its raw files?
    Thanks in advance for any help!

    The good news: Adobe allows defaults to be based on specific ISO values.
    The bad news: Defaults can not be based on ISO ranges, so those defaults don't work if you use Auto-ISO (without defining a default for every possible auto-ISO setting your camera can come up with...).
    I use CollectionPreseter to assign sharpness and noise settings based on ISO ranges (among other things). J.Friedl also has a plugin that can assign settings based on ISO ranges.
    This is all personal stuff. I'm "hyper-sensitive" to the sharpness masking/detail artefacts, and so almost never use it, but some people love it.
    I typically down-throttle sharpness detail to control noise amplification, instead of down-throttling sharpness amount or up-throttling masking - but it really depends on the photo... (and my mood ).
    Note: noise reduction is adaptive, and so it doesn't need as much variation based on ISO as you might think.
    My defaults - in general:
    - the higher the ISO, the less sharpening detail, and more lum. NR; and higher sharpen radius plus increased sharpening amount.
    Hot tip: 1st crank up the lum. NR detail slider to restore detail lost due to lum. NR before resorting to other means (at higher ISOs anyway). lum.NR contrast has an order of magnitude less impact than the lum. NR detail.
    Another hot tip: a local with -50 sharpness masks all sharpening effects without blurring - its the closest thing Lightroom has to local noise reduction.
    My default sharpening amount ranges from 35 to 50, but yours may be zero - again, personal style/taste (and also depends on lens quality and shooting skill / conditions...).
    Sorry, I talk too much...
    R

  • Anyway to apply sharpness in batch mode?

    Hello all, while I am not new to Photoshop and Camera RAW, I am to Bridge.  I processesed more than a hundred pictures using Camera Raw and my sharpness was set to high by mistake.  I know the adjustments are stored in the XMP files so I could delete them and start over.  However, all setting are fine except for the sharpening.  So I was wondering if there is a way to batch adjust the sharpness to a specific value for all selected images?

    However, all setting are fine except for the sharpening.  So I was wondering if there is a way to batch adjust the sharpness to a specific value for all selected images?
    Two options:
    First is the easiest: in Bridge go to Camera Raw preferences (Menu: Adobe Bridge CS6 / Camera raw preferences) and under general set settings for Apply sharpening to: at Previews only (to my opinion you should have this setting on by default but that's me).
    In this way your previews get a sharp look for better judgement without being applied to the opened file itself when in PS.
    Second option is to open one file and set the sharpening as you want it to be.
    Close the file and select this file in Bridge. With right mouse click you be provided with a pop up menu. Inhere chose develop settings: Copy Settings. Now select all other files you want to change and again with right mouse click choose from same menu 'paste settings.
    This provides an option window (same as the synchronize option in ACR when in filmstrip mode). In here deselect all options except for the sharpening (if you choose first only details in the drop down menu you only left with this panel setting selected)
    Then hit OK and all selected files will have only the new sharpening setting applied to.

  • How to use custom truststore?

    Hi, I've written a simple ssl client (basing on jakarta commons httpclient project) that connects to IIS with SSL and it works only i f I add ssl certificate from IIS to the jre cacerts (using keytool import). The cacerts are automatically readed somehow (don't know how)
    I want to make the whole thing more elastic and be able to provide my client with a path to cacerts / truststore / keystore. Am I doing it OK? I Currently it works...
    BUT the loops that print certificates and trustores to screen are empty - for example keystore               .getCertificateChain(alias); always returns null....
    But IIS cert is inside
    C:\\Program Files\\Java\\jre1.5.0_09\\lib\\security\\cacertsbbb
    PS. I would like to avoid setting System properties in my code like System.setTruststore etc.
    PS. Should be without sockets. Just extension of what i got.
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.InetAddress;
    import java.net.InetSocketAddress;
    import java.net.MalformedURLException;
    import java.net.Socket;
    import java.net.SocketAddress;
    import java.net.URL;
    import java.net.UnknownHostException;
    import java.security.GeneralSecurityException;
    import java.security.KeyStore;
    import java.security.KeyStoreException;
    import java.security.NoSuchAlgorithmException;
    import java.security.UnrecoverableKeyException;
    import java.security.cert.Certificate;
    import java.security.cert.CertificateException;
    import java.security.cert.X509Certificate;
    import java.util.Enumeration;
    import javax.net.SocketFactory;
    import javax.net.ssl.HostnameVerifier;
    import javax.net.ssl.HttpsURLConnection;
    import javax.net.ssl.KeyManager;
    import javax.net.ssl.KeyManagerFactory;
    import javax.net.ssl.SSLContext;
    import javax.net.ssl.SSLSession;
    import javax.net.ssl.SSLSocketFactory;
    import javax.net.ssl.TrustManager;
    import javax.net.ssl.TrustManagerFactory;
    import javax.net.ssl.X509TrustManager;
    import org.apache.commons.httpclient.ConnectTimeoutException;
    import org.apache.commons.httpclient.params.HttpConnectionParams;
    import org.apache.log4j.Logger;
    import junit.framework.TestCase;
    public class SSLSocketClient extends TestCase {
         private URL keystoreUrl = null;
         private String mockKeystoreUrl = "C:\\Program Files\\Java\\jre1.5.0_09\\lib\\security\\cacertsbbb";
         private String keystorePassword = "changeit";
         private URL truststoreUrl = null;
         private String mockTruststoreUrl = "C:\\Program Files\\Java\\jre1.5.0_09\\lib\\security\\cacertsbbb";
         private String truststorePassword = null;
         private SSLContext sslcontext = null;
         public void testSSLSocket() {
              try {
                   SSLSocketClient client = new SSLSocketClient();
                   // client.createSocket("10.63.29.50", 443);
                   HttpConnectionParams params = new HttpConnectionParams();
                   InetAddress ia = InetAddress.getLocalHost();
                   // params.setParameter(arg0, arg1)
                   //client.createSocket("10.63.29.50", 443, ia, 444, params);
                   client.connect("10.63.29.50", 443, "/ssl2/index.html", params);
              } catch (ConnectTimeoutException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (UnknownHostException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         private static Logger log = Logger.getLogger(SSLSocketClient.class);
          * private static KeyStore createKeyStore(final URL url, final String
          * password) throws KeyStoreException, NoSuchAlgorithmException,
          * CertificateException, IOException { if (url == null) { throw new
          * IllegalArgumentException("Keystore url may not be null"); }
          * KeyStore keystore = KeyStore.getInstance("jks");
          * keystore.load(url.openStream(), password != null ? password
          * .toCharArray() : null); return keystore; }
         private KeyStore mockCreateKeyStore(final String url, final String password)
                   throws KeyStoreException, NoSuchAlgorithmException,
                   CertificateException, IOException {
              if (url == null) {
                   throw new IllegalArgumentException("Keystore url may not be null");
              InputStream keystoreStream = new FileInputStream(url);
              KeyStore keystore = KeyStore.getInstance("jks");
              keystore.load(keystoreStream, password != null ? password.toCharArray()
                        : null);
              return keystore;
         private KeyManager[] createKeyManagers(final KeyStore keystore,
                   final String password) throws KeyStoreException,
                   NoSuchAlgorithmException, UnrecoverableKeyException {
              if (keystore == null) {
                   throw new IllegalArgumentException("Keystore may not be null");
              KeyManagerFactory kmfactory = KeyManagerFactory
                        .getInstance(KeyManagerFactory.getDefaultAlgorithm());
              kmfactory.init(keystore, password != null ? password.toCharArray()
                        : null);
              return kmfactory.getKeyManagers();
         private TrustManager[] createTrustManagers(final KeyStore keystore)
                   throws KeyStoreException, NoSuchAlgorithmException {
              if (keystore == null) {
                   throw new IllegalArgumentException("Keystore may not be null");
              TrustManagerFactory tmfactory = TrustManagerFactory
                        .getInstance(TrustManagerFactory.getDefaultAlgorithm());
              tmfactory.init(keystore);
              TrustManager[] trustmanagers = tmfactory.getTrustManagers();
              for (int i = 0; i < trustmanagers.length; i++) {
                   if (trustmanagers[i] instanceof X509TrustManager) {
                        trustmanagers[i] = new AuthSSLX509TrustManager(
                                  (X509TrustManager) trustmanagers);
              return trustmanagers;
         private SSLContext createSSLContext() {
              try {
                   KeyManager[] keymanagers = null;
                   TrustManager[] trustmanagers = null;
                   if (this.mockKeystoreUrl != null) {
                        KeyStore keystore = mockCreateKeyStore(this.mockKeystoreUrl,
                                  this.keystorePassword);
                        //if (log.isDebugEnabled()) {
                             Enumeration aliases = keystore.aliases();
                             while (aliases.hasMoreElements()) {
                                  String alias = (String) aliases.nextElement();
                                  Certificate[] certs = keystore
                                            .getCertificateChain(alias);
                                  if (certs != null) {
                                       log.info("Certificate chain '" + alias + "':");
                                       for (int c = 0; c < certs.length; c++) {
                                            if (certs[c] instanceof X509Certificate) {
                                                 X509Certificate cert = (X509Certificate) certs[c];
                                                 log.info(" Certificate " + (c + 1) + ":");
                                                 log.info(" Subject DN: "
                                                           + cert.getSubjectDN());
                                                 log.info(" Signature Algorithm: "
                                                           + cert.getSigAlgName());
                                                 log.info(" Valid from: "
                                                           + cert.getNotBefore());
                                                 log.info(" Valid until: "
                                                           + cert.getNotAfter());
                                                 log
                                                           .info(" Issuer: "
                                                                     + cert.getIssuerDN());
                        keymanagers = createKeyManagers(keystore, this.keystorePassword);
                   if (this.mockTruststoreUrl != null) {
                        KeyStore keystore = mockCreateKeyStore(this.mockKeystoreUrl,
                                  this.truststorePassword);
                        //if (log.isDebugEnabled()) {
                             Enumeration aliases = keystore.aliases();
                             while (aliases.hasMoreElements()) {
                                  String alias = (String) aliases.nextElement();
                                  log.debug("Trusted certificate '" + alias + "':");
                                  Certificate trustedcert = keystore
                                            .getCertificate(alias);
                                  if (trustedcert != null
                                            && trustedcert instanceof X509Certificate) {
                                       X509Certificate cert = (X509Certificate) trustedcert;
                                       log.info(" Subject DN: " + cert.getSubjectDN());
                                       log.info(" Signature Algorithm: "
                                                 + cert.getSigAlgName());
                                       log.info(" Valid from: " + cert.getNotBefore());
                                       log.info(" Valid until: " + cert.getNotAfter());
                                       log.info(" Issuer: " + cert.getIssuerDN());
                        trustmanagers = createTrustManagers(keystore);
                   SSLContext sslcontext = SSLContext.getInstance("SSL");
    //               /sslcontext.
                   sslcontext.init(keymanagers, trustmanagers, null);
                   return sslcontext;
              } catch (NoSuchAlgorithmException e) {
                   log.error(e.getMessage(), e);
                   throw new RuntimeException("Unsupported algorithm exception: "
                             + e.getMessage());
                   // throw new AuthSSLInitializationError("Unsupported algorithm
                   // exception: " + e.getMessage());
              } catch (KeyStoreException e) {
                   log.error(e.getMessage(), e);
                   throw new RuntimeException("Keystore exception: " + e.getMessage());
                   // throw new AuthSSLInitializationError("Keystore exception: " +
                   // e.getMessage());
              } catch (GeneralSecurityException e) {
                   log.error(e.getMessage(), e);
                   throw new RuntimeException("Key management exception: "
                             + e.getMessage());
                   // throw new AuthSSLInitializationError("Key management exception: "
                   // + e.getMessage());
              } catch (IOException e) {
                   log.error(e.getMessage(), e);
                   throw new RuntimeException(
                             "I/O error reading keystore/truststore file: "
                                       + e.getMessage());
                   // throw new AuthSSLInitializationError("I/O error reading
                   // keystore/truststore file: " + e.getMessage());
         private SSLContext getSSLContext() {
              if (this.sslcontext == null) {
                   this.sslcontext = createSSLContext();
              return this.sslcontext;
         * Attempts to get a new socket connection to the given host within the
         * given time limit.
         * <p>
         * To circumvent the limitations of older JREs that do not support connect
         * timeout a controller thread is executed. The controller thread attempts
         * to create a new socket within the given limit of time. If socket
         * constructor does not return until the timeout expires, the controller
         * terminates and throws an {@link ConnectTimeoutException}
         * </p>
         * @param host
         * the host name/IP
         * @param port
         * the port on the host
         * @param clientHost
         * the local host name/IP to bind the socket to
         * @param clientPort
         * the port on the local machine
         * @param params
         * {@link HttpConnectionParams Http connection parameters}
         * @return Socket a new socket
         * @throws IOException
         * @throws IOException
         * if an I/O error occurs while creating the socket
         * @throws UnknownHostException
         * if the IP address of the host cannot be determined
         public void connect(final String host, final int sport, final String query,
                   final HttpConnectionParams params) throws IOException {
              HostnameVerifier hv = new HostnameVerifier() {
                   public boolean verify(String arg0, SSLSession arg1) {
                        System.out.println("Bartek: Hostname is not matched for cert.");
                        return true;
              URL wlsUrl = null;
              wlsUrl = new URL("https", host, Integer.valueOf(sport).intValue(),
                        query);
              System.out
                        .println(" Trying a new HTTPS connection using WLS client classes - "
                                  + wlsUrl.toString());
              HttpsURLConnection sconnection = (HttpsURLConnection) wlsUrl
                        .openConnection();
              SocketFactory socketfactory = getSSLContext().getSocketFactory();
              * HttpsURLConnection sconnection = new HttpsURLConnection( wlsUrl);
              sconnection.setHostnameVerifier(hv);
              //sconnection.setSSLSocketFactory((SSLSocketFactory) socketfactory);
              sconnection.setSSLSocketFactory((SSLSocketFactory) socketfactory);
              //sconnection.setHostnameVerifier(hv);
              tryConnection(sconnection, System.out);
         public static void tryConnection(HttpsURLConnection connection,
                   OutputStream stream) throws IOException {
              connection.connect();
              String responseStr = "\t\t" + connection.getResponseCode() + " -- "
                        + connection.getResponseMessage() + "\n\t\t"
                        + connection.getContent().getClass().getName() + "\n";
              connection.disconnect();
              System.out.print(responseStr);
    Message was edited by:
    herbatniczek

    1- By default, the jre will read the user's cacerts which runs the program.
    2- You can specify another cacerts this way :
    System.setProperty("javax.net.ssl.trustStore", my_trust);
    For the case 1 and 2, you need to put the certificate in the cacerts.. Or,
    3- You implement a custom TrustManager which, for example, accepts all certificates :
    class X509TrustManagerTrustAll implements X509TrustManager {
    public boolean checkClientTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public boolean isServerTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public boolean isClientTrusted(java.security.cert.X509Certificate[] chain){
    return true;
    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
    return null;
    public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {}
    public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {}
    and you call it in the right place in the code you wrote (SSLContext,..)
    Hope it helps and deserves a duke star ;)

  • Using StreamConnection with MMAPI emulator

    Hi,
    I am using StreamConnection class to establish a socket connection with my server. If I run the application on PalmOS PDA it works fine. But when I run it in the mobile media emulator it does not connect to the server.
    Does anyone know why?
    These are the things I tried:
    1. I tried using HttpConnection instead of StreamConnection and the application is able to connect to the server on the mmapi emulator but unable to retrieve data (as I wrote teh program keeping StreamConnection in mind....this probably can be fixed, but I wanted to make it work with the StreamConnection class using sockets so that I dont have to change my programs.)
    2. I checked to see if the StreamConnection class files are present in the api zip file and I found all io classes in this zip file emptymmapi.zip
    I really dont know why it wouldn't connect using StreamConnection....
    Any answers would be really appreciated....

    The StreamConnection undoubtedly exists but sockets might not be supported.
    MIDP doesn't require sockets to be implemented so maybe opening a socket connection (socket://url:port) is impossible. Aren't you getting some "Connection scheme not supported" type exception when trying to create the StreamConnection?

  • Question about Java vm interprocess communication.

    I was doing an interprocess communication test for fun recently and bump into a questions. My intention is to start two separate Java virtual machines in two separate processes and have them do some simple interaction. This should be done without socket programming. I can do it with sockets but is this test I just want to test how can and if it is possible to do IO between java vm without sockets (or RMI, or MPI or whatever). Just process IOstreams.
    While most documentation says that Java ProcessBuilder is meant to start an external process, I want to start a java vm process and do some IO with another java vm. Most examples demonstrate how to start a command shell or an external non-java program from Java, and say how to avoid the pitfall of IO streams and do it in separate threads. I can do that with Microsoft vbscript and have it talk to Java vm. That is easy. I have created an easy one to start Microsoft Voice to read something while Java is busy with number crunching.
    So I thought it should be easy for multiple Java virtual machines, too. It turns out, I am wrong. I post the test codes below. The Java experts in the forum, please review and give your expert thoughts. The code is ugly, I have to say.
    import java.io.*;
    import java.util.concurrent.*;
    class write_q implements Runnable {
    private LinkedBlockingQueue<String> out_q=null;
    private Process vm=null;
    public write_q(Process p){
    out_q=new LinkedBlockingQueue<String>(64);
    vm=p;
    public void write(String m){
    try {
    if (m !=null) out_q.put(m);
    catch(InterruptedException e){}
    return;
    public void run(){
    OutputStream o=vm.getOutputStream();
    try {
         String vv=out_q.take();
         //System.out.println(vv);
         byte[] b=vv.getBytes();
         o.write(b);
         o.flush();
         //System.out.println(vv);
         Thread.sleep(100);
    catch(IOException e1){
         System.out.println(e1.getMessage());
    catch(InterruptedException e2){
         System.out.println(e2.getMessage());
    return;
    class read_q implements Runnable {
    private LinkedBlockingQueue<String> in_q=null;
    private Process vm=null;
    public read_q(Process p){
    vm=p;
    in_q=new LinkedBlockingQueue<String>(64);
    public String read(){
    String v=null;
    try {
         v=in_q.take();
    catch(InterruptedException e){}
    return v;
    public void run(){
    byte[] b=new byte[256];
    InputStream ins=vm.getInputStream();
    try {
    while(true){
         int s=ins.read(b);
         if (s>0){
              String t=new String(b, 0, s).trim();
              in_q.put(t);
         //System.out.println("Read: "+t);
              if(t.equals("<>")) break;
         Thread.sleep(100);
    catch(IOException e){}
    catch(InterruptedException e3){}
    // end of class read_q
    public class morep{
    private static ExecutorService es=null;
    public morep(){
    es=Executors.newFixedThreadPool(2);
    public String read(){
    String v=null;
    return v;
    public void write(String msg){
    String v=this.read();
    return;
    public static void main(String[] args){
    ProcessBuilder pb=new ProcessBuilder("java", args[0]);
    pb.redirectErrorStream(true);
    pb.directory(new File(".//"));
    Process vm=null;
    morep mp=null;
    read_q reader=null;
    write_q writer=null;
    try {
         vm=pb.start();
         mp=new morep();
         writer=new write_q(vm);
         reader=new read_q(vm);
         es.execute(reader);
         es.execute(writer);
         System.out.println(reader.read());
         writer.write("Hello");
         System.out.println("Read: "+reader.read());
         writer.write("<>");
         System.out.println(reader.read());
         vm.waitFor();
         es.shutdown();
    catch(IOException e1){
         System.out.println(e1.getMessage());
    catch(InterruptedException e2){
         System.out.println(e2.getMessage());
    System.out.print("Press any key....");
    try {
         while(System.in.read()==-1);
    catch(IOException e3){}
    // end of main(String[] args)
    // end of class morep
    // this is the one started by morep.java
    import java.io.*;
    class talker {
    public static void main(String[] args){
    System.out.println("Ok, let\'s talk.");
    System.out.println("Since I am very talkative, be aware of the nuances.");
    System.out.println("Since I am not a bad guy, be aware of the nonscense.");
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    try {
    while(true){
         String x=br.readLine();
         if (x!=null) {
              System.out.println("+++ "+x);
              if (x.equals("<>")) break;
    catch(IOException e1){
         System.out.println("+++ "+e1.getMessage());
    // end of main(String[] args)
    // end of class talker
    Compiling the files will generate morep.class, talker.class, write_q.class and read_q.class. Then the talker.class will be started by morep.class, and managed by read_q.class and write_q.class.
    Run from the command line in Windows, the program hangs after initial messages. In Task Manager, two VMs are started by the program dead locked. I was expecting both VMs close down upon receiving "<>".
    C:\myjava\loader>java morep talker
    Ok, let's talk.
    Since I am very talkative, be aware of the nuances.
    Since I am not a bad guy, be aware of the nonscense.
    Hello
    Edited by: EJP on 13/04/2011 10:44: added code tags. Please use them.

    import java.io.*;
    import java.util.concurrent.*;
    class write_q implements Runnable {
    private LinkedBlockingQueue<String> out_q=null;
    private Process vm=null;
    public write_q(Process p){
    out_q=new LinkedBlockingQueue<String>(64);
    vm=p;
    public void write(String m){
    try {
    if (m !=null) out_q.put(m);
    catch(InterruptedException e){}
    return;
    public void run(){
    OutputStream o=vm.getOutputStream();
    try {
         String vv=out_q.take();
         //System.out.println(vv);
         byte[] b=vv.getBytes();
         o.write(b);
         o.flush();
         System.out.println(vv);
         Thread.sleep(100);
    catch(IOException e1){
         System.out.println(e1.getMessage());
    catch(InterruptedException e2){
         System.out.println(e2.getMessage());
    return;
    class read_q implements Runnable {
    private LinkedBlockingQueue<String> in_q=null;
    private Process vm=null;
    public read_q(Process p){
    vm=p;
    in_q=new LinkedBlockingQueue<String>(64);
    public String read(){
    String v=null;
    try {
         v=in_q.take();
    catch(InterruptedException e){}
    return v;
    public void run(){
    byte[] b=new byte[256];
    InputStream ins=vm.getInputStream();
    try {
    while(true){
         int s=ins.read(b);
         if (s>0){
              String t=new String(b, 0, s).trim();
              in_q.put(t);
         //System.out.println("Read: "+t);
              if(t.equals("<>")) break;
         Thread.sleep(100);
    catch(IOException e){}
    catch(InterruptedException e3){}
    // end of class read_q
    public class morep{
    private static ExecutorService es=null;
    public morep(){
    es=Executors.newFixedThreadPool(2);
    public String read(){
    String v=null;
    return v;
    public void write(String msg){
    String v=this.read();
    return;
    public static void main(String[] args){
    ProcessBuilder pb=new ProcessBuilder("java", args[0]);
    pb.redirectErrorStream(true);
    pb.directory(new File(".//"));
    Process vm=null;
    morep mp=null;
    read_q reader=null;
    write_q writer=null;
    try {
         vm=pb.start();
         mp=new morep();
         writer=new write_q(vm);
         reader=new read_q(vm);
         es.execute(reader);
         es.execute(writer);
         System.out.println(reader.read());
         writer.write("Hello");
         System.out.println("Read: "+reader.read());
         writer.write("<>");
         System.out.println(reader.read());
         vm.waitFor();
         es.shutdown();
    catch(IOException e1){
         System.out.println(e1.getMessage());
    catch(InterruptedException e2){
         System.out.println(e2.getMessage());
    System.out.print("Press any key....");
    try {
         while(System.in.read()==-1);
    catch(IOException e3){}
    // end of main(String[] args)
    // end of class morep
    }

  • Convert Eclipse ME project to Java ME SDK 3.0

    Hi
    I've created a j2me midlet in eclipse and would now like to import or convert the project to use with new Java ME SDK 3.0. Any help would be appreciated?
    Thanks

    Hi,
    there is no import wizard from Eclipse project (maybe we could think about it). I would recomment you:
    1. create a new MIDP Application project (without Hello MIDlet)
    2. copy your midlet (including package structure) into "src" folder of your new project
    3. open project properties, go to Application Descriptor category and register your midlet on MIDlets tab
    Regards,
    Radko

  • Http interface(behind the seen is it tcp/ip)

    Well we use connection framework for to talk with webserver(Behind the seen is it using tcp/ip.If it is using tcp/ip then why midp don't give access to directly use socket class also.and who give the implementation of Connection object.I mean all are interfaces under the Connector interface.
    HttpConnection c = (HttpConnection)Connector.open(url);
    Can any body tell the reason for it.
    Thanks
    Jawwad Ahmed

    Hi
    depends what point in the end to end communication path you are considering. Certainly at your web server you will see HTTP over TCP/IP. But at the device, things are not so simple. In Telecomms terms, your device has a number of communications bearers that it supports. These are not protocols, more entire comms systems. So for example, SMS text messaging in GSM networks is often described as a bearer and it can be used to provide the transport for http or wtp (WAP)traffic. The same is true of GPRS or of CSD (circuit switched data). Each of these is a wireless telecomms system of some sort and your device will support one or more of them (my examples are all GSM ones, if you're in the US you have other, similar systems such as CDMA and TDMA networks... either way, the principal is the same). So, a kind of tunneling approach is taken at the device, usually refered to as "bearer adaptation". Your MIDLet uses HTTP, but the comms stack ultimately will result in this being handled by one of the underlying bearers.
    As for Socket support, well I guess you have your answer. It may be difficult or impossible to provide a true socket interface if the underlying bearer(s) are not suited to this.
    Some MIDP devices do support socket communications. This is non-standard however and you should not expect to find this support on every device.

  • HTTP  Interface.

    hi experts!!!
    i am working in a class builder work for HTTp Interface.in that i have implimented the Create,Get Comads using open dataset which opens /create files in server.
    now i want to set Mime type. in Create i am not getting the Mime type where i have folwoing code:
    l_entity = m_server->request.
    l_data = l_entity->get_data( ).
    l_mimetype = l_entity->get_header_field(
    name = 'Content-Type' ).
    can any one please help me how to set Mime type and please send mr some documents on this task..
    please help me...
    mahesh

    Hi
    depends what point in the end to end communication path you are considering. Certainly at your web server you will see HTTP over TCP/IP. But at the device, things are not so simple. In Telecomms terms, your device has a number of communications bearers that it supports. These are not protocols, more entire comms systems. So for example, SMS text messaging in GSM networks is often described as a bearer and it can be used to provide the transport for http or wtp (WAP)traffic. The same is true of GPRS or of CSD (circuit switched data). Each of these is a wireless telecomms system of some sort and your device will support one or more of them (my examples are all GSM ones, if you're in the US you have other, similar systems such as CDMA and TDMA networks... either way, the principal is the same). So, a kind of tunneling approach is taken at the device, usually refered to as "bearer adaptation". Your MIDLet uses HTTP, but the comms stack ultimately will result in this being handled by one of the underlying bearers.
    As for Socket support, well I guess you have your answer. It may be difficult or impossible to provide a true socket interface if the underlying bearer(s) are not suited to this.
    Some MIDP devices do support socket communications. This is non-standard however and you should not expect to find this support on every device.

  • How to get respose time of URLs

    hi,
    I want to calculate response time of any URL. I implemented it with a Socket class and I/O streams opened on it.
    But the response time value seems to be greater than actually it is. What are the other ways to implement this.
    Thanks

    itsraja wrote:
    thanks and is there any standard way of calculating it.Already answered in Reply 1.
    And apart from sockets and streams is there any other way to accomplish this problem.If you want to find out how long it takes to connect to a URL and receive the response, then you do have to connect to the URL and receive the response. If you can figure out how to do that without sockets and streams then good luck to you.

  • Can I get iphoto back?

    I don't find the new Photos app intuitive at all and would love to go back to iPhoto.
    How do I export an image as a custom size?
    How do I use the 'skin tone' adjustment?
    How do I bump the sharpness all the way up without affecting the other settings?
    How do I scroll through the images in an album and note the number of each?
    These are all things I could do in seconds with iPhoto and I find Photos jarringly dissimilar.

    1 - export via the File ➙ Export
    2 - don't see a skin tone adjustment in Photos.  Is that the point you're trying to make?
    3 - just move the intensity slider in the Sharpen sections that should not change any of the other settings.
    4 - two ways.
         A - type Command + i to bring up the Info pane which shows the file name and then scroll thru the photos.  The window will stay open where you place it.
         B - first set the titles to be shown in this menu window:
    Check to see if any of your titles show.  If not then use this Applescript in the Users Tips for Photos to put the file name of each photo into the Title field for each thumbnail: Photos for Mac: Batch Changing the Titles to the Filename
    Other batch renaming scripts are available in the Photos for Mac User Tips

  • Error connecting to GPRS

    Hi there
    I have a Palm Treo 750 unlocked, lately I had problems connecting throgh GPRS and getting the error message "a connection already exists with this name"
    Please let me know how to solve this problem.
    Thanks
    Post relates to: None

    [zhenglc],
    some source codes on the client:
    HttpConnection c = null;
    c = (HttpConnection)Connector.open(url);
    c.setRequestMethod(HttpConnection.POST);
    c.setRequestProperty("IF-Modified-Since", "20 Jan 2001
    16:19:14 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-1.0
    Configuration/CLDC-1.0");You might want to recode this line above to:
    String userAgent = "Profile/" + System.getProperty("microedition.profiles") + " Configuration/" + System.getProperty("microedition.configuration");
    c.setRequestProperty("User-Agent", userAgent);This way, you are not specifying the User-Agent header value for one specific device, hence ensuring that you can deploy this MIDlet on any J2ME CLDC/MIDP compliant device without having to modify the code for each device.
    Please try this code and let us know the results.
    c.setRequestProperty("Content-Language", "zh-CN");
    Should i config the jrun server to support MIDP? and
    where to config it?You don't actually need the c.setRequestProperty("User-Agent", <value>) method call to tell the web server the type of user agent you have in the device, it's optional.

Maybe you are looking for

  • [Solved] Mounting Partitions from Beginners Guide

    Hi everyone. I've setup Arch before, but I see that the installer has been removed. I had a question on some of the documentation from the Beginners Guide... From the section "Prepare the storage drive" it states to setup the partitions like so: Name

  • Photoshop CS5 64 bit will not open in windows 8

    PS CS5 will not open in windows 8 (neither will lightroom install)

  • How to view images from PC on MAC

    Have iMAC 10.6.8. Using iPhoto '09. Have lots of pictures saved on CD downloaded from a PC. Problems viewing them on MAC. First, what is an easy way to view them on MAC without transferring them, and secondly, what is the best way to transfer them to

  • I tried to connect to iTunes and only get a plug logo on iPad

    Ok, I got an iPad--my dad got it in a random drawing at work, but he gave it to me to "play"" with. Now, the problem is: 1. The first day, I connected it to the wi-fi network in my home. 2. It connected properly. I was able to use the iPad to access

  • New motherboard ATV not showing up in itunes

    I have a "new" computer in that the motherboard had to be replaced, along with the hard drive... I can't get my Apple TV to show in devices in itunes. In itunes prefs I have "look for apple tvs" checked. The ATV is connected to my wireless network. A