You Are Here:

Community: Developer Discussion Boards

#1 Old Selecting access point in 1.9.2 with socket module? - 2009-04-02, 14:06

Join Date: Feb 2009
Posts: 10
mauso
Offline
Registered User
I'm using the standard socket module (not btsocket) for multiple tcp connections in my pys60 1.9.2 application.

Is there any means to set the default access point before establishing connection? set_default_access_point()-function is moved to btsocket-module and does not have effect when using the standard socket module.
Reply With Quote

#2 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-02, 14:11

Join Date: Mar 2003
Posts: 125
Location: UK
aya42
Offline
Regular Contributor
Quote:
Originally Posted by mauso View Post
Is there any means to set the default access point before establishing connection? set_default_access_point()-function is moved to btsocket-module and does not have effect when using the standard socket module.
I believe the answer is no. If you want to avoid access point selection, you'll have to create the socket with the btsocket.socket() rather than the socket.socket().
Reply With Quote

#3 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-17, 02:11

Join Date: Feb 2009
Posts: 23
sbn
Offline
Registered User
I've got a related problem, I want to get data from a http URL using urllib - but even though i do the btsocket.set_default_acces_point() etc. it keeps asking me every time i run the script that uses urllib
Reply With Quote

#4 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-17, 19:13

Join Date: Mar 2003
Posts: 125
Location: UK
aya42
Offline
Regular Contributor
Quote:
Originally Posted by sbn View Post
I've got a related problem, I want to get data from a http URL using urllib - but even though i do the btsocket.set_default_acces_point() etc. it keeps asking me every time i run the script that uses urllib
Problem is that urllib imports the socket module, not the btsocket module, so you'll have to ensure that sys.modules['socket'] points to the btsocket module before importing urllib.

This should work consistently on all versions...

Code:
import sys

# Try to import 'btsocket' as 'socket' - ignore on versions < 1.9.x
try:
    sys.modules['socket'] = __import__('btsocket')
except ImportError:
    pass

# For v1.9.x - Import the 'btsocket' module as 'socket'
# For v1.4.x - Import 'socket' module
import socket

# Set up AP
apid = socket.select_access_point()
apo = socket.access_point(apid)
socket.set_default_access_point(apo)

# Now importing urllib should use 'btsocket' instead of 'socket' on v1.9.x
import urllib
Reply With Quote

#5 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-20, 16:55

Join Date: Nov 2007
Posts: 310
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
I think you solved my problem as well (in Wordmobi), aya42 ;-) Thanks !
Testing ...


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
Reply With Quote

#6 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-21, 06:01

Join Date: Apr 2007
Posts: 131
mahesh.sayibabu's Avatar
mahesh.sayibabu
Offline
Regular Contributor
Quote:
Originally Posted by mauso View Post
I'm using the standard socket module (not btsocket) for multiple tcp connections in my pys60 1.9.2 application.

Is there any means to set the default access point before establishing connection? set_default_access_point()-function is moved to btsocket-module and does not have effect when using the standard socket module.
Soon, there will be an API that allow one to set the default access point for the standard socket module.
Reply With Quote

#7 Old Re: Selecting access point in 1.9.2 with socket module? - 2009-04-21, 12:54

Join Date: Nov 2007
Posts: 310
Location: Sertaozinho/Brazil
Send a message via MSN to marcelobarrosalmeida Send a message via Skype™ to marcelobarrosalmeida
marcelobarrosalmeida's Avatar
marcelobarrosalmeida
Offline
Forum Nokia Champion
Tested and running fine !

For those that do not know Python so well as aya42, an explanation about sys.modules from Dive into Python.


Marcelo Barros
Nokia E71, N800, N95 and XM 5800
http://www.croozeus.com
http://wordmobi.wordpress.com
http://jedizone.wordpress.com
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
Transforming WiFi connectivity and access point creation script to python module oguzkirat Python 3 2009-10-10 20:34
Nokia 3555 WAP Access Point Problem kamyu2881 Mobile Java Networking & Messaging & Security 2 2008-11-25 14:55
Access Point Connection Problem on N96... Help! asenechalM5T Symbian Networking & Messaging 4 2008-11-17 16:00
Changing J2ME access point on 7270 aidygallagher Mobile Java General 2 2006-10-23 19:52
selecting access point by code gauravj116 Symbian Networking & Messaging 3 2004-11-09 05:55

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: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d121773X 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