void Accept_Read_End(IAsyncResult ar)
{
Accept_SO stateObj = (Accept_SO)ar.AsyncState;
try
{
stateObj.UpdateContext();
stateObj.ReadBytes += NStream.EndRead(ar);
if(stateObj.ReadBytes < 8)
{
//------------------------------------
// Continue read the response from proxy server.
//
NStream.BeginRead(
_response,
stateObj.ReadBytes,
8 - stateObj.ReadBytes,
new AsyncCallback(Accept_Read_End),
stateObj);
}
else
{
VerifyResponse();
stateObj.SetCompleted();
}
}
catch(Exception e)
{
stateObj.Exception = e;
stateObj.SetCompleted();
}
}