Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User beobeo796's Avatar
    Join Date
    Sep 2009
    Posts
    25
    I have an app do this: send a String to server once in 10 seconds. But i don't know exactly how to do that and i don't have a server to test, so i have 2 ways that i think could be good. You guy can help me?! Thanks!

    1. I put these in Run:

    Code:
     public void run()
        {
            try 
            {
                int i = 0;
                    i ++;
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
    
                String s;
                while ( ! (s = is.readUTF()).equals("bye") ) {
                    form.append("< " + s + "\n");
                }
            } catch (IOException ex) {
                ex.printStackTrace();
                form.append("[end]\n");
            }
        }
    2. Put in function where i want it repeat

    Code:
    try
                {
                    int i = 0;
                    i ++;
                    try {
                        Thread.sleep(10000);
                    } catch (InterruptedException ex) {
                        ex.printStackTrace();
                    }
                    os.writeUTF( "$ITP" + "," + s + "," + date + "," + time + ","  + data + "\r");
                    os.flush();
                    
                } catch (IOException ioe)

    Thanks for any help from nice guys here ^^

  2. #2
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hey,
    You can use Form to append the String after every 10 seconds.

    Since you don't have the server so you can write your own code for the server.Send the string from the client and receive the same string there at the server.and on server you can draw the string on a form or canvas.

    For this you can either use-
    1.HTTP
    2.Socket are the preferable ways.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Super Contributor mahbub_s60's Avatar
    Join Date
    Mar 2008
    Posts
    1,481
    Quote Originally Posted by beobeo796 View Post
    I have an app do this: send a String to server once in 10 seconds. But i don't know exactly how to do that and i don't have a server to test, so i have 2 ways that i think could be good. You guy can help me?! Thanks!

    1. I put these in Run:

    Code:
     public void run()
        {
            try 
            {
                int i = 0;
                    i ++;
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
    
                String s;
                while ( ! (s = is.readUTF()).equals("bye") ) {
                    form.append("< " + s + "\n");
                }
            } catch (IOException ex) {
                ex.printStackTrace();
                form.append("[end]\n");
            }
        }
    2. Put in function where i want it repeat

    Code:
    try
                {
                    int i = 0;
                    i ++;
                    try {
                        Thread.sleep(10000);
                    } catch (InterruptedException ex) {
                        ex.printStackTrace();
                    }
                    os.writeUTF( "$ITP" + "," + s + "," + date + "," + time + ","  + data + "\r");
                    os.flush();
                    
                } catch (IOException ioe)

    Thanks for any help from nice guys here ^^
    Though I am not a Java person, best way you fire a timer and get a notification and then use http to write the data.

  4. #4
    Nokia Developer Champion Tiger79's Avatar
    Join Date
    Apr 2007
    Posts
    2,697
    A Timer would have been my first answer as well...

  5. #5
    Registered User beobeo796's Avatar
    Join Date
    Sep 2009
    Posts
    25
    Thanks.
    But what about 2 ways that i gave?! Are they correct?

Similar Threads

  1. Can't kill process when console is enabled
    By alav in forum Symbian C++
    Replies: 3
    Last Post: 2007-11-28, 19:07
  2. Message Sending failed !!!!!
    By ankushbabrekar in forum Symbian C++
    Replies: 3
    Last Post: 2007-03-23, 05:06
  3. Message Sending failed !!!!!
    By ankushbabrekar in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-03-21, 07:09
  4. Sending EEikCmdExit command to a different process?
    By prakash_s23 in forum Symbian C++
    Replies: 2
    Last Post: 2007-02-14, 15:26
  5. Error sending SMS
    By jorge_c in forum Multimodecards
    Replies: 0
    Last Post: 2003-10-07, 11:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved