public override uint ReceiveAsync(ref SNIPacket packet)
{
lock (this)
{
packet = new SNIPacket(null);
packet.Allocate(_bufferSize);
try
{
packet.ReadFromStreamAsync(_stream, _receiveCallback);
return TdsEnums.SNI_SUCCESS_IO_PENDING;
}
catch (ObjectDisposedException ode)
{
return ReportErrorAndReleasePacket(packet, ode);
}
catch (SocketException se)
{
return ReportErrorAndReleasePacket(packet, se);
}
catch (IOException ioe)
{
return ReportErrorAndReleasePacket(packet, ioe);
}
}
}