
Originally Posted by
bruce2000
I mean, can these python script use in PSP, For instance, Create socket,open connection ... etc ?
Yes, you should be able to use socket functions under Apache.
What it is the limitation python script in PSP compare with Python for S60?
we knew we can NOT "import appuifw" in PSP,right?
That's correct, you cannot use appuifw; it's a current limitation of PyS60. See also my other posting in the Camera access restrictions thread.
The PSP page would look like below:
Should this python script work with PSP?
Must PSP page been placed in .../mod_python/psp folder?
No, you can place it anywhere you like provided you modify httpd.conf. But why not start with having it in that directory and move it to its final location when you know that it otherwise works.
Code:
<html>
<body>
# server socket
<%
import socket
import e32
...
I can't comment in detail since I don't know anything about the LightBlue API.
But it seems to me that you intend to create a server socket inside a request handler. That's not likely to be a good idea. Namely, a request handler is supposed to execute fast, and if you create a server socket inside it, it's completely unbounded exactly how long the execution will take. Conceptually that's difficult and will in practice lead to number of problems - for instance, since Raccoon currently is single threaded, it will be completely blocked in that handler while waiting for someone to connect.
A better approach would be to have a separate server listening for Bluetooth connections and then from within the request handler connect to that server and ask for the data. That is, the request handler would look like:
Code:
connect to server
if succeeded
ask for data
print data
else
print error message
endif
Johan