私は現在、PythonでRDPクライアントを構築しようとしています。私はlenチェックで次の問題を発見しました。python len計算
から:http://msdn.microsoft.com/en-us/library/cc240836%28v=prot.10%29.aspx
81 2a -> ConnectData::connectPDU length = 298 bytes Since the most significant bit of the first byte (0x81) is set to 1 and the following bit is set to 0, the length is given by the low six bits of the first byte and the second byte. Hence, the value is 0x12a, which is 298 bytes.
これは奇妙に聞こえます。通常のlenのチェックのために
、私は単純に使用しています:struct.pack(">h",len(str(PacketLen)))
が、この場合には、私は本当に上記のように、私がlenを計算することができますどのように表示されませんが。
これについてのお手伝いをさせていただきますようお願い申し上げます。
ありがとう! 私はまだエラーが発生しています: struct.error: 'h'フォーマットには-32768 <= number <= 32767が必要です 何が良いのでしょうか? – n00bz0r
'h'が署名型であるため、あなたはおそらく署名されていないバージョン、' H'を望みます。 – SingleNegationElimination
伝説、ありがとう! – n00bz0r