void SendCompleted(object sender, SocketAsyncEventArgs e)
{
if (e.SocketError == SocketError.Success)
{
BOUT += e.BytesTransferred;
OUT++;
//Send again if there are more packets in the queue
if (m_outgoingQueue.Count > 0)
{
QueueSend();
}
else
{
//Unset the sending flag if there is nothing more to send
Interlocked.Exchange(ref sending, 0);
}
}
}