I have an app which uses a ServerSocket to serve HTML over HTTP on localhost to a HTMLViewer, in order to play a video file. Works great.
However, testing in Big Sur reveals an interesting glitch: If I close the window (which destroys both the ServerSocket and the HTMLViewer), and then re-open the window and try it again, sometimes on Big Sur it does not work. I get a blank screen, and the HTMLViewer’s error event fires with a -1001 Timeout after a couple of minutes.
If I try it again immediately, it works - so it basically works every other time
If, after closing the window, I wait about 60 seconds and try it again, it works.
ServerSocket.Listen always succeeds and there are no errors.
When it falis, ServerSocket.AddSocket never fires, as if there is no connection attempt being made at all.
I’m using the same port number each time
My theory is that the safari video playback engine in Big Sur is not letting go of the sockets immediately, so that when I try to start everything over, the port is still busy and it fails.
Anyone else out there using ServerSockets on BigSur and noticing problems?
I’m using Xojo 2019R1.1.
I’ts experience that tells me this and some apple big sur forum post. Search for port blocked big sur.
When we changed to big sur, some of our serversocket (listening) ports where blocked or unable to work normally). We changed all ports to a number >= 10000 and all worked normal again.
Maybe requires a fb request so xojo can investigate?
while true
do
lsof -nP -iTCP:XXXXX # replace with the Port number you are using
sleep 2
done
I was able to see that some sockets were, indeed staying open, even after the ServerSocket, all of the TCPSockets, and even the HTMLViewer had been destoyed.