Dynamic buffer for Network Data Transmission

Source: Internet
Author: User

Dynamic buffer for Network Data Transmission

AnyChat has the buffer and file transmission function, which can realize the buffer and file transmission between the client and the client, as well as the buffer and file transmission function between the client and the server (added in V4.1 ).

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. SDKFilter 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, the callback function that will trigger B: transparent channel data callback function (see 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 (refer to: 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 (refer to: 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 Data interface)

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 is triggered: Upper-layer Custom Data callback function definition (refer to: 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: SDK Filter Communication Data callback function (refer to: 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;

5. Buffer data transmission between the client and the server (transparent channel interface)

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.

(Refer to 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 Filter Data interface is the same as that of the transparent channel interface. The transparent channel interface is designed to be compatible with the client API 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 callback function of the server is triggered: transparent channel data extension callback function (refer to: 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 extended callback function (refer to: 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 files to the server, the server triggers the file transfer callback function (refer to 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 (refer to: 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.