protected void asyncReceive(IAsyncResult result)
{
try
{
int read = tcpClient.GetStream().EndRead(result);
if (read > 0)
{
receiveIndex += read;
handleReceive();
}
tcpClient.GetStream().BeginRead(
receiveBuffer,
receiveIndex,
receiveBuffer.Length - receiveIndex,
asyncReceive,
receiveBuffer);
}
catch (InvalidOperationException)
{
}
catch (System.IO.IOException)
{
}
catch (ThreadAbortException)
{
}
}