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?



  • @jeromemaquoi
    really better if you show some sample what do.
    As you can read here detail was provided by chat
    but better is write on the forum and ask question with sample and exact error message.



  • Hello livius,

    I have the same problem but I don't understand what you said about it. How can I fix this problem?

    Have a nice evening,

    Jérôme Maquoi



  • 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
 

Pycom on Twitter