Re: Socket exception



What value are you setting to m_sendlock? It will need to be unique for each thread.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com



"bogma" <m.bogensperger@xxxxxxxxxxx> wrote in message news:1170153656.152377.228940@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

Hi Bryan,
the SendRaw code block is locked, so that only one thread can send.

public bool SendRaw(byte[] data, int size)
{
lock (m_sendlock)
{
if (m_socket != null)
{
if (data != null && size > 0)
{
try
{
int totalsent = 0;
do
{
int sent = m_socket.Send(data, totalsent, size - totalsent,
SocketFlags.None);
totalsent += sent;
} while (totalsent < size);
return true;
}
catch (Exception ex)
{
_log.Error("Error in CWTcpReceiver::Send:", ex);
}
}
}
}
return false;
}

.


Loading