×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Bluetooth L2CAP Socket: Read() vs. Recv()

    Hello everyone,

    I've modified the sample BluetoothPointToPoint application that comes with the 7650 developer kit to use L2CAP sockets instead of RFCOMM. It seems to work fine, but one of the changes I had to make was to change the original server to read from the socket using Read() instead of RecvOneOrMore(). If I used RecvOneOrMore() (or even plain Recv()) I got a system error -5, which I believe is KErrNotSupported. Now, this has me a bit stumped because the only caveat mentioned by the API for RSocket is that RecvOneOrMore() (or Recv()) must be used on a connected socket, which my L2CAP socket certainly is. The only difference I can see about L2CAP sockets is that they are of type "Sequenced Packet", but I do not understand how this precludes the use of Recv(). Can someone please explain?

    Incidentally, could someone also explain how come Read() will return after reading only 30 bytes into the provided descriptor, even though the descriptor is declared as TBuf8<32>? This seems to contradict the API documentation for Read() which says "The function only complete when the full amount of requested data has been received (or the connection breaks). This means when the descriptor has been filled to its maximum length (not its current length)."

    Cheers,

    james

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

    RE: Bluetooth L2CAP Socket: Read() vs. Recv()

    Hi James,

    Read() requires a connected socket just as RecvOneOrMore(), so I don't think socket being connected has anything to do with the problem.

    Have you tried using KSockStream instead of KSockSeqPacket as the socket type? (Or KSockDatagram/KSockRaw?)

    Does anyone know why RecvOneOrMore doesn't work? Forum Nokia? (Using Read() is much more clumsy.)

    Regards,

    Andrew

    PS. Thanks for the hint of using Read(). I was also trying to use RecvOneOrMore and was getting the same error.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    3
    Hi,

    I downloaded example code "BluetoothPMPExample" from Nokia Forum and I tried to convert this Point-to-Multipoint Bluetooth code to use L2CAP instead of RFCOMM. I faced same problem (N-Gage, SW v. 3.30, SDK 1.2), but fortunately I found your email with the "Read()"-solution.

    Thanks,

    Heikki

Posting Permissions

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