You Are Here:

Community: Developer Discussion Boards

#1 Old using the pdis sockets - 2005-03-01, 00:04

Join Date: Jan 2005
Posts: 20
pollyp
Offline
Registered User
Greetings --

I want to have simultaneous Bluetooth and GPRS sessions. My understanding is that the current s60 Python doesn't support that, but that I can use the PDIS sockets to accomplish the same end.

I have a few questions about how to use the PDIS code. On the BT side, I want to do the connection and just read data off the socket. As best as I can figure out, I want to use test_ntvsock_bt.py as my template. Is that correct, or is there another piece of documentation/code snippet I should be looking at?

Assuming I'm looking at the right thing, what's the purpose of the AoSocketServ class? Is it multiplexing and demultiplexing the traffic? And how does AoLoop work?

Thanks in advance for any hints.

Polly
Reply With Quote

#2 Old 2005-03-01, 14:55

Join Date: Nov 2004
Posts: 14
terohiit
Offline
Registered User
Before deciding which code snippets to look at, the question to ask is
whether you want to go with an event-based or multi-threaded design.
In the former case, test_ntvsock_bt_*.py and test_native_socket_tcp.py
might serve as examples, but not necessarily as templates to use in a
proper application, as not all the test-programs behave nicely in
error situations, for instance. symbian_async_socket.py provides a
slightly higher-level event-based API, and test_tcp_asyncsock.py
demonstrates its use.

If one instead wanted to use blocking sockets and multiple threads,
say so as to accept connections with one thread and have clients
serviced in other threads, one could use the pdis.net.abstract_socket
API. PDIS itself uses this approach, although there is some overhead
involved. test_mgsock_bt.py is a small example of using the API.

Note that some of the test-programs may be out of date due to frequent
API changes in the PDIS socket library, and the API being such a
moving target kind of speaks in favor of using the builtin socket API
whenever possible.

An AoSocketServ just wraps a handle to a Symbian socket server
session. Such a session is required (typically one is enough) for
creating sockets, and the session must stay alive for as long as the
sockets are being used.

An AoLoop, when start()ed, runs an event loop until stop() is called,
after which the call to start() returns. You could do something very
similar with e32.Ao_lock.

Tero
Reply With Quote

#3 Old 2005-03-03, 22:46

Join Date: Jan 2005
Posts: 20
pollyp
Offline
Registered User
Thanks for your reply, Tero. It was very useful.

What's an example of a test program that uses blocking sockets for gprs sockets? Do I want to be looking at tes_async_webcl? Or is there a better example?

Thanks,

Polly
Reply With Quote

#4 Old 2005-03-04, 00:18

Join Date: Nov 2004
Posts: 14
terohiit
Offline
Registered User
I don't think there are any good examples of that among the test-programs, but you could try something like

from aosocket.symbian.tcp import TcpManager
manager = TcpManager()
cl_socket = manager.connect(("pdis.hiit.fi", 80))
cl_socket.sendall("GET / HTTP/1.0\n\n")
print str(cl_socket.recv(512))
cl_socket.close()
manager.close()
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

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