#using .NET 4 - VS2010

Hi one hi all!
Using the example from http://www.undisciplinedbytes.com/20...mplementation/ , I have managed to add basic webSocket support to me TCP server engine. As I have very little knowledge in html and interested only on the sever side I came across few questions regarding the implementation of the WebSockets server:
1)Does the buffer of the handshake arriving from the client, always arrives in one chunk?

2)If not, how can I tell when I have all the handshake message?

3)I have change ‘ws’ to ‘wss’ (both in client and server) in order to use the secure option. As
a result the handshake from the client arrives (what seems to be) encrypted, how can
encrypt it? Where is the key?

Thank you all