def serialize(self, withTimeField=True): bp = BinaryPacker() if withTimeField: bp.put(UINT32, self.time) bp.put(UINT64, bitset_to_int(self.services)) bp.put(BINARY_CHUNK, quad_to_binary(self.addrQuad).rjust(16,'\x00')) bp.put(UINT16, self.port, endianness=NETWORKENDIAN) return bp.getBinaryString()
def serialize(self, withTimeField=True): bp = BinaryPacker() if withTimeField: bp.put(UINT32, self.time) bp.put(UINT64, bitset_to_int(self.services)) bp.put(BINARY_CHUNK, quad_to_binary(self.addrQuad).rjust(16, '\x00')) bp.put(UINT16, self.port, endianness=NETWORKENDIAN) return bp.getBinaryString()
def serialize(self): bp = BinaryPacker() bp.put(INT32, self.version ) bp.put(UINT64, bitset_to_int(self.services)) bp.put(INT64, self.time ) # todo, should this really be int64? bp.put(BINARY_CHUNK, self.addrRecv.serialize(withTimeField=False)) bp.put(BINARY_CHUNK, self.addrFrom.serialize(withTimeField=False)) bp.put(UINT64, self.nonce ) bp.put(VAR_STR, self.subver ) bp.put(INT32, self.height0 ) return bp.getBinaryString()
def serialize(self): bp = BinaryPacker() bp.put(INT32, self.version) bp.put(UINT64, bitset_to_int(self.services)) bp.put(INT64, self.time) # todo, should this really be int64? bp.put(BINARY_CHUNK, self.addrRecv.serialize(withTimeField=False)) bp.put(BINARY_CHUNK, self.addrFrom.serialize(withTimeField=False)) bp.put(UINT64, self.nonce) bp.put(VAR_STR, self.subver) bp.put(INT32, self.height0) return bp.getBinaryString()