Mercurial > repos > rhope
diff net.rhope @ 166:1bfc19076f1b
Merge
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 10 Mar 2011 04:16:38 +0000 |
parents | 47ab97730865 429afd920a23 |
children |
line wrap: on
line diff
--- a/net.rhope Thu Mar 10 04:15:37 2011 +0000 +++ b/net.rhope Thu Mar 10 04:16:38 2011 +0000 @@ -309,7 +309,15 @@ { If[[buffer]Length] { - out,err <- [con]_Write[buffer,0] + If[[Raw Size[[buffer]Eltype >>]] > [1]] + { + bytelen <- [[buffer]Length]*[Raw Size[[buffer]Eltype >>]] + //Copy to a byte buffer until we have a better way of writing from an arbitrary byte offset + bbuffer <- [_internal_array_copychunk[buffer, 0, _internal_array_allocnaked[bytelen, UInt8()], 0, [buffer]Length]]Length <<[bytelen] + }{ + bbuffer <- Val[buffer] + } + out,err <- [con]_Write[bbuffer,0] }{ out <- con } @@ -395,6 +403,15 @@ } } +Read Type@TCP Connection[con,toread(Int32),type(Blueprint):data,out con,err] +{ + toreadbytes <- [toread]*[Raw Size[type]] + ,out con,err <- [con]Read[toreadbytes] + { + data <- [_internal_array_copychunk[~, 0, _internal_array_allocnaked[toread, type], 0, toreadbytes]]Length <<[toread] + } +} + _Check Partial[buffer,delim,offset:partial,none] { none <- If[[offset]=[[buffer]Length]] {}