Hi,
I've been attempting to make a simple bluetooth connection between two n95's running s60 third edition to no avail. After frustrating attempts with the basic pys60 sockets I decided to enlist the lightblue api. This works a bit better (the devices connect), but the 'server' device errors when receiving data. The error I get is:
File "C;/etc." line 60 in ?
conn.recv(1024)
File "<string>", line 2, in recv
File "c:\resource\socket.py", line 353, in recv
data = self._sock.recv[n, f, cb] error:[0, 'Error']
and the code:
import socket, lightblue, e32, appuifw
SERVER, CLIENT = 0, 1
addr = "00:1E:3A:23:53:0D"
port = 5
mode = appuifw.popup_menu([u"Receive",
u"Sender"],
u"Which are you?")
if mode == SERVER:
s = lightblue.socket()
s.bind(("", port)) # bind to 0 to bind to dynamically assigned port
print "waiting for client"
s.listen(1)
lightblue.advertise("My RFCOMM Service", s, lightblue.RFCOMM)
conn, addr = s.accept()
print "Connected by", addr
conn.recv(1024)
conn.close()
elif mode == CLIENT:
s = lightblue.socket()
s.connect((addr, port))
s.send("hello")
print "sent hello"
s.close()
I'd really appreciate any help in getting this resolved, or if you've had a similar problem to try and identify the reason behind it.
This is the first time I've posted to the Nokia forum and I'm new to python and symbian60, go easy on me...
Thanks

Reply With Quote

