dpeckham - 2007-03-29

Logged In: YES
user_id=1520768
Originator: YES

After more thinking on this, I have a better solution. GetBuffer() is efficient in terms of memory usage--ToArray() creates a copy. But we can fix this better on the SockIO class. If we overload Write(byte[] bytes) to Write(byte[] bytes, int offset, int count) then the method can pass the correct (read "used") length of the buffer on to the network stream:

public void Write(byte[] bytes)
{
this.Write(bytes, 0, bytes.Length);
}

public void Write(byte[] bytes, int offset, int count)
{
...
_networkStream.Write(bytes, offset, count);
}

Then the MemcachedClient will call sock.Write(val,0,realLength) at line 760.

Comments?