How to Use the buffer and file transfer functions?
AnyChat has the buffer and file transmission function, which can realize the buffer and file transmission between the client and the client, and also implement the buffer and file transmission function between the client and the server. V4.1 adds the function ).
The buffer and file transfer channels between AnyChat clients are as follows:
1. Transparent channel API interface: BRAC_TransBuffer;
2. Transparent channel extension API interface: BRAC_TransBufferEx;
3. File Transfer API interface: BRAC_TransFile;
The buffer and file transfer channels between the AnyChat client and the server are as follows:
1. SDK Filter Data API interface: BRAC_SendSDKFilterData, BRAS_SendBufToUser, BRAS_SendBufToRoom;
2. Transparent channel API interfaces: BRAC_TransBuffer and BRAS_TransBuffer;
3. Transparent channel extension API interfaces: BRAC_TransBufferEx and BRAS_TransBufferEx;
4. File Transfer API interfaces: BRAC_TransFile and BRAS_TransFile;
1. Use transparent channels to transmit data between clients
After A and B log on to the server, they can use the transparent channel API to transmit data. When A uses the API: BRAC_TransBuffer to send data to B, B receives the data, callback function that will trigger B: transparent channel data callback function reference: BRAC_SetTransBufferCallBack ).
The kernel uses the TCP channel for transmission, ensuring that the recipient receives the same order as the sending order, and that the data is reachable without packet loss;
2. Use transparent channels to expand data transmission between clients
After A and B log on to the server, they can use the transparent channel extension API to transmit data. When A uses the API: BRAC_TransBufferEx to send data to B, B receives the data, callback function that will trigger B: transparent channel data extension callback function reference: BRAC_SetTransBufferExCallBack ).
The kernel uses the UDP channel for transmission. It does not guarantee that the recipient receives the same order as the sending sequence, but ensures data accessibility and automatic retransmission of packet loss;
3. File Transfer between clients
After logging on to the server, A and B users can use the file transfer API to send files. When A uses the API: BRAC_TransFile to send files to B, B receives the files, callback function that will trigger B: File Transfer callback function reference: BRAC_SetTransFileCallBack)
The kernel uses the UDP channel for transmission. It does not guarantee that the recipient receives the same order as the sending sequence, but ensures data accessibility and automatic retransmission of packet loss;
4. Buffer Data transmission between the client and the server SDK Filter DataInterface)
After client A successfully logs on to the server, you can use the SDK Filter Data interface to transmit Data.
1. When the client uses the API: BRAC_SendSDKFilterData to send data to the server, the callback function of the server will be triggered: Upper-layer Custom Data callback function definition reference: BRAS_SetOnRecvUserFilterDataCallBack)
2. When the server uses the API interfaces BRAS_SendBufToUser and BRAS_SendBufToRoom to send data to the client, the callback function of the client is triggered: SDKFilter Communication Data callback function reference: BRAC_SetSDKFilterDataCallBack)
The kernel uses the TCP channel for transmission, ensuring that the recipient receives the same order as the sending order, and that the data is reachable without packet loss;
V. Transparent channel interface for transmitting buffer data between the client and server)
After client A successfully logs on to the server, it can use the transparent channel interface to transmit data with the server.
1. When the client uses the API: BRAC_TransBuffer to send data to the server, the callback function of the server is triggered: transparent channel data callback function.
Reference: BRAS_SetTransBufferCallBack)
2. When the server uses the API: BRAS_TransBuffer to send data to the client, the callback function of the client is triggered: transparent channel data callback function;
The kernel uses the TCP channel for transmission, ensuring that the recipient receives the same order as the sending order, and that the data is reachable without packet loss;
Note: the efficiency of the SDK FilterData interface is the same as that of the transparent channel interface. The transparent channel interface is designed to be compatible with client APIs and is added to the V4.1 server, note that the callback functions corresponding to the two are different)
6. Use the extended buffer channel to transmit data between the client and server
After client A successfully logs on to the server, it can use the extended buffer channel to transmit data with the server.
1. When the client uses the API: BRAC_TransBufferEx to send data to the server, the server's callback function will be triggered: transparent channel data extension callback function reference: BRAS_SetTransBufferExCallBack)
2. When the server uses the API: BRAS_TransBufferEx to send data to the client, after the client receives the data, it will trigger the callback function of the Client: transparent channel data extension callback function reference: BRAC_SetTransBufferExCallBack ).
The kernel uses the UDP channel for transmission. It does not guarantee that the recipient receives the same order as the sending sequence, but ensures data accessibility and automatic retransmission of packet loss;
VII. File Transfer between the client and the server
After client A successfully logs on to the server, you can use the file transfer interface to transfer files with the server.
1. When Client A uses the API: BRAC_TransFile to send A file to the server, the server will trigger the callback function of the server: File Transfer callback function reference: BRAS_SetTransFileCallBack) After receiving the file );
2. When the server uses the API: BRAS_TransFile to send a file to the client, after the client receives the file data, it will trigger the callback function of the Client: File Transfer callback function reference: BRAC_SetTransFileCallBack );
The kernel uses the UDP channel for transmission. It does not guarantee that the recipient receives the same order as the sending sequence, but ensures data accessibility and automatic retransmission of packet loss;
Note: The "Server" mentioned above refers to the service-layer Server developed using the AnyChat Server SDK.