You Are Here:

Community: Developer Discussion Boards

#1 Old python, s60 and socket - 2009-04-28, 14:46

Join Date: Apr 2009
Posts: 3
hjohan
Offline
Registered User
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?
Reply With Quote

#2 Old Re: python, s60 and socket - 2009-04-28, 15:30

Join Date: Nov 2008
Posts: 24
catch
Offline
Registered User
You need to bind it and initially load (import) the library to execute such methods.
Reply With Quote

#3 Old Re: python, s60 and socket - 2009-04-28, 17:47

Join Date: Apr 2009
Posts: 3
hjohan
Offline
Registered User
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')
Reply With Quote

#4 Old Re: python, s60 and socket - 2009-04-29, 16:10

Join Date: Nov 2008
Posts: 24
catch
Offline
Registered User
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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Python for S60 1.9.4 is now released tvijayan Python 9 2009-05-27 11:39
Python for S60 1.9.3 released tvijayan Python 40 2009-04-03 16:00
Python for S60 1.9.1 released tvijayan Python 30 2009-02-26 07:16
Python for S60 1.9.0 released tvijayan Python 48 2009-01-27 16:39
S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? www_peach General Symbian C++ 0 2005-09-20 04:58

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ