[ENet-discuss] File transfers w/ e-net

Thorbjørn Lindeijer bjorn at lindeijer.nl
Wed May 12 04:36:38 PDT 2010


On Wed, May 12, 2010 at 08:23, Mike Diehl <mdiehl at diehlnet.com> wrote:
> The project that I'm working on will require the ability to move files to/from
> the client and server.
>
> There seem to be two possible extremes here:
>
> 1.  I create one potentially large packet that contains ALL of the file's
> content and send it over a reliable channel.  E-net would handle all of the
> fragmentation and just "do the right thing" for me.  However, this would be a
> tremendous memory hog.
>
> 2.  I keep a file handle open and send out a chunk of file each time through
> the main loop.  Seems like this would make my code more complex.
>
> Is there any example code or advice anyone would like to offer?

I don't think ENet is very suitable for this use-case, and I'd
definitely expect the second option to work better. But did you
consider transferring the files outside of ENet, using a more suitable
protocol like for example HTTP? Just because your game uses ENet
doesn't mean you have to use it for everything. :-)

Regards,
Bjørn


More information about the ENet-discuss mailing list