32feet icon indicating copy to clipboard operation
32feet copied to clipboard

Consistent socket error 10055

Open antoniohlopes opened this issue 3 years ago • 1 comments

Hello, I have using inthehand.net with .NETCF 3.5 (in a new ARM Cortex-A7, 2020 model, with Windows Embedded 7.0 build 2806). The error (10055) always happens from the 16th time that has a socket error 10061 . Once, this error is thrown, no more connections can be made, the terminal must be restarted. Why the error 10061 occurs 16 times? is because target device was powered off. 10061: {"No connection could be made because the target machine actively refused it"} 10055: {"An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"} I have try to release any resource, as "WSACleanup" , but without success. I have attached the class BthClient that uses IntheHand.32feet, and my test program. There is a way to avoid this error, disposing some mysterious object? Thank you, for any help Antonio H Lopes

BthClient_MainForm_Test.zip

antoniohlopes avatar Apr 21 '21 01:04 antoniohlopes

Maybe, do not fix the problem, but recycling the last not successfully connection, is a way to keep resources in stock.

private static Stack<BluetoothClient> btPool = new Stack<BluetoothClient>();
// when instancing
if (btPool.Count > 0)
{
    btClient = btPool.Pop();
}
else
{
    btClient = new BluetoothClient();
}
// in exception, keep the object BluetoothClient in pool
if (sex.ErrorCode == 10061)
{
    btPool.Push(btClient);
    btClient = null;
}
Dispose();
throw;

antoniohlopes avatar Apr 21 '21 05:04 antoniohlopes