void VerifyResponse()
{
string msg = null;
//------------------------------------
// Verify reply format. Pass 4 even it
// against the RFC.
//
if((_response[0] != 0) && (_response[0] != 4))
{
msg = string.Format("Socks4: Reply format is unknown ({0}).", _response[0]);
throw new ProtocolViolationException(msg);
}
//------------------------------------
// Verify the response
//
if(_response[1] != 90)
{
byte err = _response[1];
if(91 == err)
msg = string.Format("Socks4: Request rejected or failed ({0}).", err);
else if(92 == err)
msg = string.Format("Socks4: Request rejected because SOCKS server cannot connect to identd on the client ({0}).", err);
else if(93 == err)
msg = string.Format("Socks4: Request rejected because the client program and identd report different user-ids ({0}).", err);
else
msg = string.Format("Socks4: Socks server return unknown error code ({0}).", err);
}
if(null != msg)
throw new SocketException(SockErrors.WSAECONNREFUSED);
// throw new ProxyErrorException(msg);
}