enet icon indicating copy to clipboard operation
enet copied to clipboard

Proof of concept for large data transfer utility to send large amount of data between two hosts.

Open benoit-germain opened this issue 11 years ago • 0 comments

Usage:

Two connected hosts first agree on a channel to send the data through. They can do this any way they choose.

Once an agreement is reached, the receiving end is responsible for handling any data received in that channel. On the sending side, a data job is created with enet_host_register_datajob(). The function receives, among other things, a callback that provides data.

The callback returns the amount of data written, and should return 0 when done. The callback receives a buffer pointer to write the data to. When the pointer is null, either the jobs has been cancelled or the job has completed. IT is then time to perform any necessary cleanup.

Cleanup on the receiving side is application dependant. For example, during channel negocation, the sender might provide the amount of data it wants to transfer. Then on the receiving end, a file where received data is stored should be closed when the receiver detects it has received the specified amount.

The sending application must also call enet_host_process_datajobs() when it knows jobs are registered (usually do this at the same time as enet_host_service).

benoit-germain avatar May 04 '13 06:05 benoit-germain