×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    20

    using the pdis sockets

    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

  2. #2
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    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

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    20
    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

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    18
    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()

Posting Permissions

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