Mark- 29 Posted February 26, 2020 Hello, I have a customer when opening a form with a TWSocket on it gets the following error: Error reading PrimaryTCP.ReqVerLow: Not a Winsocket error (#87 in SetReqVerLow: WinSock version can't be changed now). I have no idea the cause. Any ideas? Thanks, Mark Share this post Link to post
Angus Robertson 574 Posted February 26, 2020 I think that property goes back to Windows XP or something when there were different versions of winsock. But they currently default to 2 and need never be changed. You should only get that error if your application tries to change ReqVerLow after TWSocket has loaded, and why would you want to? Angus Share this post Link to post
Mark- 29 Posted February 26, 2020 (edited) Thanks for the response. > ReqVerLow after TWSocket has loaded, and why would you want to? I would not want to and if this is the ReqVerHigh and ReqVerLow in the object inspector they are both set to 1 and I did not set them. Edited February 26, 2020 by Mark- Share this post Link to post
Mark- 29 Posted February 26, 2020 (edited) OK I found the error. We added some code, earlier in program execution, nothing to do with the TWSocket generating the error, using THttpCli. It is initialized first and CtrlSocket.ReqVerLow and CtrlSocket.ReqVerHigh are indeed set to 2. Now creating the TWSocket port, when the form opens using 1, as was streamed with the form, causes the crash. So we change all the TWSockets to 2 or set the THttpCli to 1. Edited February 27, 2020 by Mark- Share this post Link to post
Angus Robertson 574 Posted February 27, 2020 Not sure how that could happen, THttpCli does not reference ReqVerHigh or ReqVerLow and the underlying TWSocket is not accessible for writing in current versions. ReqVerHigh or ReqVerLow would only be saved in the DFM if you changed them from the default of 2, again unless you are using an ancient version of ICS. Angus Share this post Link to post
Mark- 29 Posted February 27, 2020 (edited) OK, here is how. This program was started 13 years ago. Still going strong. 😉 Using the current version of ICS. I have 40+ old/still using forms/DMs with TWSocket on them, created years ago. All these DFMs had 1 the for the low and high property. I did not change/set/alter the ReqVerHigh or ReqVerLow properties. No, problem all works and has been for years. In the previous two months an THttpCli was added and it is called/loaded/used first in the program. It is dynamically created and the default for the CtrlSocket(TWSocket) is indeed 2 as you stated. Now, the program starts, Winsock 2 is used by the THttpCli, one of the old DFMs is used/loaded and kaboom. > ReqVerHigh or ReqVerLow would only be saved in the DFM if you changed them from the default of 2, ReqVerHigh = 1 and ReqVerLow = 1 was in all the DFMs that had a TWSocket. I grepped and replaced them all with 2 and problem solved. Perhaps I should remove them all and let the current version default value apply. Edited February 27, 2020 by Mark- Share this post Link to post
Angus Robertson 574 Posted February 27, 2020 If you can do so easily, removing ReqVerHigh and ReqVerLow from the DFMs is safest, maybe an earlier release of Delphi stored default values or you set them to 1 after the default changed to 2, when is not noted in the unit Can not see the winsock version changing again in my life time. The next low level change is likely to be QUIC which Google has been developing for several years, this uses UDP for TCP like streams, so should not involve winsock, it should be supported by OpenSSL within a year or so, once the spec is finalised. Angus Share this post Link to post
Mark- 29 Posted February 27, 2020 (edited) 1 hour ago, Angus Robertson said: If you can do so easily, removing ReqVerHigh and ReqVerLow from the DFMs is safest... I concur and it is done. Thanks for your help. Edited February 27, 2020 by Mark- Share this post Link to post