Skip to content

Commit

Permalink
Update tcp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0pearce committed Sep 27, 2016
1 parent e705cb3 commit 204e5bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions umodbus/client/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def _create_mbap_header(slave_id, pdu):
:param pdu: Byte array with PDU.
:return: Byte array of 7 bytes with MBAP header.
"""
# 65536 = 2**16 aka maximum number that fits in 2 bytes.
transaction_id = randint(0, 65536)
# 65535 = (2**16)-1 aka maximum number that fits in 2 bytes.
transaction_id = randint(0, 65535)
length = len(pdu) + 1

return struct.pack('>HHHB', transaction_id, 0, length, slave_id)
Expand Down

0 comments on commit 204e5bc

Please sign in to comment.