@verb #139:"read" this none this rxdo #55 @program #139:"read" this none this "$blob:read(con[, length]) => BLOB - reads 'length' characters from 'con'" " con - network connection to read from" " con - network connection to read from" " length - number of characters to read. If not specified, stops after one read() call." "If more bytes are returned than are requested by 'length', the remainder are force_inputted back into the beginning of the connections buffer. This means that they will be parsed next, if hold-input is 0, or will be read next if hold-input is 1." {con, ?len = E_NONE} = args set_task_perms(caller_perms()) v = {} while (1) if (connection_option(con, "binary")) packet = read(con) else try set_connection_option(con, "binary", 1) packet = read(con) finally set_connection_option(con, "binary", 0) endtry endif packet = decode_binary(packet, 1) v = {@v, @packet} if (len == E_NONE || length(v) >= len) break endif endwhile if (typeof(len) != ERR && length(v) > len) rest = v[len + 1..$] v = v[1..len] if (connection_option(con, "binary")) force_input(con, encode_binary(rest), 1) else try set_connection_option(con, "binary", 1) force_input(con, encode_binary(rest), 1) finally set_connection_option(con, "binary", 0) endtry endif endif return $blob:new(@v) "Last modified by manta (#7165) on Tue Mar 20 09:36:59 2001 MST." "This verb previously owned by manta (#7165), and chowned to $slacker upon dewizarding (Sat Aug 17 14:50:05 2002 MDT)." "Last modified by Dax (#789) on Sat Aug 17 14:50:05 2002 MDT." .