On 14-03-2011 18:21, Peter Duniho wrote:
> On 3/14/11 3:03 PM, Bjørn Brox wrote:
>> [...]
>>> You told the computer to decode the entire buffer, so that is what it
>>> did. If you had told it to decode only part of the buffer then it
>>> would have done that.
>>>
>> Well, - go back to the first post, - it is Microsoft, not Arne who made
>> this error in their example.
>>
>> http://msdn.microsoft.com/en-us/libr...aff.aspx#Y1103
>
> It's true, the networking code examples in MSDN are not very good.
> However, it's important to note that that example is for the
> Socket.Receive() method, not the Encoding.GetString() method. It does
> correctly demonstrate the use of the Socket.Receive() method, albeit in
> a context where the rest of the code is not correct.
How the output from the call should be used is relevant for
the call.
> It is a very important skill to have, when reading documentation, to
> understand the scope of the documentation and to follow-up with the
> actual documentation for any other library or language elements that the
> code example might include.
I would expect the other code in the example to be correct. It may
be necessary to consult the documentation to the see what it does
or to do something differently. But having to consult the documentation
to find out what the code is not correct is absurd.
> So, yes…the original documentation being referenced isn't quite right.
That is an understatement. I would say that it is not right.
Arne