MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Binary IO



Chuck Adams wrote:
> 
> > How do I do this?  Right now, I'm digging through the ChangeLog, looking for
> > some way to change the size of the output buffer.
> >
> 
> It's in options.h, and you have to recompile the server for this.

I was actually looking for an in-database way to do it.  I fixed the code to do 
something like (I'm not logged in so I can't see the actual code I wrote)

set_connection_option(connection, "binary", 1);
set_connection_option(player, "binary", 1);
page = encode_binary("");
while (typeof(line = read(connection)) != ERR)
  page = page + line;
endwhile
while ((l=length(page)) > 0)
  space = output_buffer_length() - output_buffer_length(player);
  if (space == 0)
    suspend(0);
  elseif (l > space)
    part = page[1..space];
    page = page[space+1..$];
    notify(player, part);
    suspend(0);
  else
    notify(player, page);
    page = encode_binary("");
  endif
endwhile
boot_player(player);

That works, although as I said, it was slow.  If I end up using the proxy 
regularly (I'm waiting for the OK from the owner of the computer and the people 
in the network that the computer is on before I use it), I'll hack up a faster 
way to do it.

Phantom


References:

Home | Subject Index | Thread Index