Angus Funny thing, when the error happens, getlasterror from SSL returns:
error:1408F10B:SSL routines:ssl3_get_record:wrong version number The disconnection is easily reproduceable by spawning a few threads Eric On Wed, Oct 3, 2018 at 2:01 PM Éric Fleming Bonilha <e...@digifort.com.br> wrote: > Angus > > I'm trying to make a demo application to test this behavior, but now I'm > stuck with another problem.. random disconnects.. > > I'm using latest ICS 8.53 with OpenSSL that is shipped with the ICS > > Whenever I start sending data from server -> client, the client will > disconnect randomly. > > It happens if I'm sending from a thread or even only from the main thread > (from a timer), please check this demo app: > > http://www.digifort.com/temp/SSLMultithread.rar > > I've found that the client disconnection is happening here: > TCustomSslWSocket.Do_FD_READ > > Res := my_BIO_read(FSslBio, @Dummy, 0); //Pointer(1) > if Res < 0 then begin > if not my_BIO_should_retry(FSslBio) then begin > > > my_BIO_read returns -1 and then my_BIO_should_retry returns FALSE > > I see this comment on the code: > { Get number of bytes we can receive and store in the network > input bio. } > { New call to BIO_ctrl_get_read_request in order to read only the > amount } > { of data from the socket that is needed to satisfy a read > request, if } > { any. Without that call I had random errors on bi-directional > shutdowns. } > > > Do you have any ideas why the client is being disconnected on this demo > app? > > This demo app is very simple.. I simply send data to the connected client, > and when data is received I increment a number of received bytes per second > > Eric > > > On Wed, Oct 3, 2018 at 12:38 PM Angus Robertson - Magenta Systems Ltd < > an...@magsys.co.uk> wrote: > >> > I'm currently using OpenSSL 1.0.2h and I tried with latest ICS I >> > downloaded yesterday (8.53) >> >> Does your application include OverbyteIcsSslThrdLock.pas? That is >> needed to make locking work with 1.0.2. >> >> If you use 1.1.0 or 1.1.1, that unit is not needed. >> >> But I don't know much about OverbyteIcsSslThrdLock, never used it >> myself. It is used by OverbyteIcsWSocketTS.pas which I assume you are >> using, but I've never looked at that unit, don't know if the OpenSSL >> stuff is up to date. There is only one demo that uses it, a simple >> socket server, not HTTP or anything easy to test. >> >> I have been meaning to look at a threaded web server, but never had the >> time. >> >> Angus >> >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be >> > -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be