×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    101

    Red face data from pc to my mobile..

    Hello everyone,
    I have a code that can send "Hello" from pc using python to my mobile. But I have trouble displaying it to my phone..here is part of the recieving code on the phone.

    buf = ""
    while True:
    r=sock.read().strip()
    buf +=r
    print buf

    the output:
    H
    He
    Hel
    hell
    Hello
    How can I make it display simply 'Hello'..I appreciate any help.


    picuser

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: data from pc to my mobile..

    Hi,

    My guess is you should print buf outside the loop. That way it will only be displayed once, at the end.
    Code:
    buf = ""
    while True:
        r=sock.read().strip()
        buf +=r
    print buf
    Please use code tags when posting code (the button with the # symbol in the editor). That keeps the code indented and easier to read.
    Last edited by bogdan.galiceanu; 2009-07-25 at 14:24.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    101

    Smile Re: data from pc to my mobile..

    Hi, thanks for the reply. I tried that already but nothing displays.
    Sorry about not using the code tags...

    regards

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: data from pc to my mobile..

    Well normally it should display after the loop is exited. I don't know what your entire code looks like, but try something like this:
    Code:
    def stop():
        global running
        running = False
    
    appuifw.app.exit_key_handler = stop
    
    running = True
    while running:
        r=sock.read().strip()
        buf +=r
        e32.ao_sleep(0.05)
    
    print buf
    That way, when you press the right softkey you will exit from the "while" loop and buf should be displayed.

  5. #5
    Registered User
    Join Date
    Dec 2008
    Posts
    101

    Re: data from pc to my mobile..

    okay got it....thanks for the idea....

Similar Threads

  1. Mobile learning server / environment published
    By mikaset in forum News and Announcements
    Replies: 0
    Last Post: 2008-03-25, 20:50
  2. PC Suite ConnAPI data transfer rate
    By raymondxie in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-01-08, 23:06
  3. How do I transfer Nokia PC Suite data from my PC to another PC?
    By lenardnelson in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2004-02-26, 19:07
  4. How do I transfer Nokia PC Suite data from my PC to another PC?
    By lenardnelson in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-03, 06:10
  5. BT-enabled Mobile and data applicationn on a device -not necessarily PC
    By Nokia_Archive in forum Bluetooth Technology
    Replies: 1
    Last Post: 2002-05-27, 22:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×