}
readPacket <- function(io) {
+ socketSelect(list(io))
header <- readChunk(io, 6)
len <- strtoi(header, base=16)
payload <- readChunk(io, len)
printToString <- function(val) {
f <- fifo("")
- tryCatch({ sink(f); print(val); sink(); readLines(f) },
+ sink(f)
+ tryCatch({
+ tryCatch(str(val, indent.str="", list.len=5, max.level=2),
+ finally=sink())
+ readLines(f) },
finally=close(f))
}