×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    python, s60 and socket

    Hi,

    my code is:

    import socket
    HOST='xxxxxxx'
    PORT='xx'

    s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST,PORT))
    print "connected"
    s.close()

    This isn't work my nokia mobile (N76 so it is s60 phone), why?

  2. #2
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: python, s60 and socket

    You need to bind it and initially load (import) the library to execute such methods.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Re: python, s60 and socket

    I'm stupid! Now I get error:

    Traceback (most recent call last):
    File "/testaus.py", line 12, in <module>
    s.bind((HOST,PORT))
    File "<string>", line 1, in bind
    error: (99, 'Cannot assign requested address')

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    24

    Re: python, s60 and socket

    Study this code. This might help you out.

    Code:
    import socket
    
    HOST = ''                 
    PORT = 80              
    print "define the socket"
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    print "bind the socket"
    s.bind((HOST, PORT))
    s.listen(1)
    print "waiting of the client to connect"
    conn, addr = s.accept()
    print 'Connected by', addr
    while 1:
        data = conn.recv(1024)
        if not data: break
        conn.send(data)
    conn.close()
    Cheers

Similar Threads

  1. Python for S60 1.9.4 is now released
    By tvijayan in forum Symbian
    Replies: 9
    Last Post: 2009-05-27, 10:39
  2. Python for S60 1.9.3 released
    By tvijayan in forum Symbian
    Replies: 40
    Last Post: 2009-04-03, 15:00
  3. Python for S60 1.9.1 released
    By tvijayan in forum Symbian
    Replies: 30
    Last Post: 2009-02-26, 06:16
  4. Python for S60 1.9.0 released
    By tvijayan in forum Symbian
    Replies: 48
    Last Post: 2009-01-27, 15:39
  5. Replies: 0
    Last Post: 2005-09-20, 03:58

Posting Permissions

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