[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: 2 Player mode
On 10.10.2006 20:26, Henk Jonas wrote:
> Jens Granseuer wrote:
> > The one thing we need dynamicity (?) for is history->Save( buffer ),
> > and string could be wrapped to do that, but it doesn't support
> > SDLNet_Recv( socket, string.c_str(), size )...
> >
>
> Well you first read the header, extract the size info for the following
> data, do a malloc(size) and pass this pointer to SDLNet_Recv.
>
> Why not?
Because it doesn't map nicely to a proper i/o abstraction (reading would
not work symmetrically to writing which is ugly, ugly, ugly; or you'd need
to do some internal bookkeeping to sync the string and the char buffer which
isn't nice, either). Anyway, I've got a simple (though as yet untested)
dynamic buffer class now, so we'll see how that goes.
Jens