public void Send(MemoryStream stream)
{
if (stream != null && stream.Length > 0)
{
stream.Position = 0;
//try
//{
lock (SendQueue)
{
SendQueue.Enqueue(stream.GetMemoryStream(0));
}
mreSender.Set();
//}
//catch (ArgumentException)
//{
// //For some odd reason I'm getting an occasional ArgumentException:
// //Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
// //This does not make sense, and there is nothing I can do to fix. So I am choosing to ignore it,
// // hoping that things will still work.
//}
}
}
//TODO: remove this routine in favor of the MemoryStream version.