×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    Receiving Data Error in Lightblue

    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

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    Re: Receiving Data Error in Lightblue

    I found that the socket variable name was the same as another variable in another part of the code. Just underlines the importance of meaningful variable names.

Similar Threads

  1. Replies: 3
    Last Post: 2008-09-09, 04:53
  2. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56
  3. Replies: 0
    Last Post: 2005-02-25, 10:09
  4. Replies: 2
    Last Post: 2004-09-15, 22:47
  5. 6360 not receiving or transferrng data but ird is connected
    By mortgagehelper in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-08-15, 12:41

Posting Permissions

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