Buffer size **SOLVED**

  • Hello,

    I was using struct to unpack a message with destination, source address, length of Ack and Ack as the following *** _LORA_ACK_FORMAT = "!4s4sBB"
    *** recv_pkg = lora_sock.recv(512)
    *** dest_addr,src_addr,pkg_len msg = struct.unpack(_LORA_PKG_FORMAT % recv_pkg_len, recv_pkg) . I get ValueError: buffer too small. What might be causing this? Any suggestion?

  • solved by chat

    reason was in

    recv_pkg_len = recv_pkg[1]

    but package was modified by different device_ID length
    and for modified device length - data length was in different place

    recv_pkg_len = recv_pkg[8]

    and in

    struct.unpack(_LORA_PKG_FORMAT % recv_pkg_len, recv_pkg)

    instead recv_pkg_len=4 recv_pkg_len got value 164
    caused ValueError: buffer too small

Log in to reply

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.