tox.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:milisia-tox 作者: milisarge 项目源码 文件源码
def callback_file_recv_chunk(self, callback, user_data):
        """
        Set the callback for the `file_recv_chunk` event. Pass NULL to unset.

        This event is first triggered when a file transfer request is received, and subsequently when a chunk of file
        data for an accepted request was received.

        :param callback: Python function.
        When length is 0, the transfer is finished and the client should release the resources it acquired for the
        transfer. After a call with length = 0, the file number can be reused for new file transfers.

        If position is equal to file_size (received in the file_receive callback) when the transfer finishes, the file
        was received completely. Otherwise, if file_size was UINT64_MAX, streaming ended successfully when length is 0.

        Should take pointer (c_void_p) to Tox object,
        The friend number (c_uint32) of the friend who is sending the file.
        The friend-specific file number (c_uint32) the data received is associated with.
        The file position (c_uint64) of the first byte in data.
        A byte array (c_char_p) containing the received chunk.
        The length (c_size_t) of the received chunk.
        pointer (c_void_p) to user_data
        :param user_data: pointer (c_void_p) to user data
        """
        c_callback = CFUNCTYPE(None, c_void_p, c_uint32, c_uint32, c_uint64, POINTER(c_uint8), c_size_t, c_void_p)
        self.file_recv_chunk_cb = c_callback(callback)
        self.libtoxcore.tox_callback_file_recv_chunk(self._tox_pointer, self.file_recv_chunk_cb, user_data)

    # -----------------------------------------------------------------------------------------------------------------
    # Low-level custom packet sending and receiving
    # -----------------------------------------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号