OpenNetworkConnection limit
Posted: Mon Feb 10, 2020 12:24 pm
Hello! I discovered strange behavior
With a uncommented line, the code can work almost indefinitely. But if the line is commented out and client disconnected on the server side, then the number of possible connections is limited to ~ 16300 connections. I monitored the number of connections with cports: The server correctly disconnected, but the client does not understand that the dynamic ports are already free.
update:
I looked at TCP connections on the client side with the netstat -anobq command and found only one connection on port 5555. But at the same time, I observe problems with the browser and network connections at the moment of reaching 16300 connections. Closing the client restores the normal operation of Windows.
Code: Select all
Global count
Procedure Tcpsrv_connect(param)
Print("connection")
Protected ccontrol_port.l=5555
Protected ccontrol_ip.s="192.168.101.252"
Protected ConnectionID
ConnectionID = OpenNetworkConnection(ccontrol_ip, ccontrol_port)
If ConnectionID
SendStr.s="ok"+#CRLF$
count = count+1
PrintN(" - "+Str(count))
SendNetworkString(ConnectionID, SendStr, #PB_Ascii)
; CloseNetworkConnection(ConnectionID)
EndIf
EndProcedure
InitNetwork()
OpenConsole()
While 1
Tcpsrv_connect(1)
Delay(20)
Wend
update:
I looked at TCP connections on the client side with the netstat -anobq command and found only one connection on port 5555. But at the same time, I observe problems with the browser and network connections at the moment of reaching 16300 connections. Closing the client restores the normal operation of Windows.