![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hi, i have a real problem with the socket based communication of our client-server application. the application (c# .net 1.1) works well for all of our customers except one. i encounter socket exceptions in arbitrary intervals on this site (once or twice a day). the exception occurs on a socket.Send call and it states: System.InvalidOperationException: Cannot block a call on this socket, while an earlier async one is in progress. at System.Net.Sockets.Socket.ValidateBlockingMode() at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at ComWin.TcpLib.CWTcpReceiver.SendRaw(Byte[] data, Int32 size) I haven't got a clue how to track down this error. I have tried to reproduce the failure but had no luck. maybe somebody can give me a hint what can cause this error or what can be done to locate the failure ... |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
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; } |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |