Update timeout for socket connections in Windows CE

I am testing how our software handles connection errors. We use socket.BeginConnectthe callback function with the function. The endpoint IP address and / or port number are intentionally invalid. The callback function is called after ~ 21 s each time (with a timeout and connection failure, of course). I would like to be able to adjust the timeout up or down for testing or final deployment.

According to this MSDN article for Windows CE 5.0, the key HKLM\Comm\Tcpip\Parms\TcpInitialRTTlooks useful. But I tried the values ​​1, 2, 3, and 22, and the timeout does not change from ~ 21. After each change, the computer rebooted.

Can I set a timeout for OS / TCP / IP socket connections? Using C # and the .NET Compact Framework.

+1
source share
1 answer

You must do this using

IAsyncResult result = mysocket.BeginConnect(...)

then wait on

result.AsyncWaitHandle.WaitOne(yourtimeouthere, false);
+1
source

Source: https://habr.com/ru/post/1708601/


All Articles