Just answering cos no one else has... sorry if I don't answer your question.

I would guess the showmodal/etc. is 'locking' the message queue because you 
calling it from within a socket event.

From my investigations I can suggest:
move the socket processing to its own thread and only process GUI items in the 
main thread.
OR
Generate another GUI event in your socket event that your app message queue can 
pick up to then display the message/form and keep GUI processing out of your 
socket event handlers.

I would think the second item is easier than the first, although both amount to 
the same thing - freeing up the socket message queue to carry on processing by 
finishing the socket event.

HTH


Stephen Dickason
Senior Developer - Managed Services
  Email: sdicka...@elcb.co.za

ELCB Information Services (Pty) Ltd
Customer Service Email  e...@elcb.co.za · www.elcb.co.za
E A S T  L O N D O N
Tel: +27(43)  704 0700
Fax: +27(43) 704 0701
J O H A N N E S B U R G
Tel: +27(11) 879 6179
Fax: +27(11) 454 0384
P O R T  E L I Z A B E T H
Tel: +27(41) 373 0529
Fax: +27(86) 650 0135
Disclaimer

> -----Original Message-----
> From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of Éric
> Fleming Bonilha
> Sent: Tuesday, August 16, 2016 0:08
> To: ICS support mailing
> Subject: Re: [twsocket] Compiling with SSL active changes socket behavior
>
> Could anyone check this? Or at least acknowledge that it was received?
>
> Thanks
>
>
>
> On Sat, Aug 13, 2016 at 3:13 PM, Éric Fleming Bonilha <e...@digifort.com.br>
> wrote:
>
> > I evaluated a little more on this behavior and realized that actually
> > many many parts of our software will open a SHOWMODAL dialog to the
> > response of a message from the server, that is parsed with our
> > protocol parser from within the OnDataAvailable event of the socket,
> > and this behavior completely broken our software because now everytime
> > it opens a form from within the dataavailable event (indirectly), the
> > socket will no longer process any more messages while the form is
> > open, and I guess that this is wrong...
> >
> > Since ICS is designed to be asynchronous it should not prevent me from
> > opening a form using showmodal as a response of a socket message...
> >
> > Just to make clear, I'm using a PLAIN TCP socket without SSL
> >
> > Well, researching a little more on the issue I found this:
> >
> > procedure TCustomSslWSocket.Do_FD_READ(var Msg: TMessage); var
> >     Len        : Integer; // How much to receive
> >     Buffer     : array [0..(SSL_BUFFER_SIZE * 2) -1] of AnsiChar;
> >     NumRead    : Integer;
> >     nError     : Integer;
> >     Res        : Integer;
> >     PBuf       : TWSocketData;
> >     Dummy      : Byte;
> > begin
> >  { V8.22 moved here from Do_SSL_FD_READ  }
> >     WSocket_Synchronized_WSAASyncSelect({$IFDEF POSIX}Self,{$ENDIF}
> >          FHSocket, Handle, FMsg_WM_ASYNCSELECT, FD_WRITE or FD_CLOSE
> > or FD_CONNECT);
> >     try
> >         if (not FSslEnable) or (FSocksState <> socksData) or
> >            (FHttpTunnelState <> htsData) then begin
> >             inherited Do_FD_READ(msg);
> >             Exit;
> >         end;
> >
> >
> >
> > The problem seems to be with this first call from
> > CustomSslWSocket.Do_FD_READ:
> >     WSocket_Synchronized_WSAASyncSelect({$IFDEF POSIX}Self,{$ENDIF}
> > FHSocket, Handle, FMsg_WM_ASYNCSELECT, FD_WRITE or FD_CLOSE or
> > FD_CONNECT);
> >
> > If I just comment out this routine, then the problem is solved but I
> > guess that SSL will not work (I'm not using SSL at this moment anyway)
> >
> > In my point of view, if I'm using a plain socket without SSL, this
> > TCustomSslWSocket class should NOT interfere with the operation of the
> > socket and should just call inherited Do_FD_READ in case SSL is not
> > being used instead of calling some socket routine...
> >
> > Would someone please look into this issue? I can make some example
> > application to demonstrate the behavior (I just don't know how to
> > properly fix it)
> >
> > Thanks
> >
> >
> >
> > On Sat, Aug 13, 2016 at 2:50 PM, Éric Fleming Bonilha <
> > e...@digifort.com.br> wrote:
> >
> >> Hi
> >>
> >> I recently came across an issue with our software after updating to
> >> ICS
> >> 8.26
> >>
> >> We previously used ICS 8.06 and its default compiling directives did
> >> not add SSL support, but 8.26 by default activates SSL and makes
> >> TWSocket class to be derived from SSL socket
> >>
> >> I don't know if the problem is related to the SSL socket derivation
> >> but probably yes since deactivating SSL will make socket behave like
> >> before, which makes me think that could be a bug because socket
> >> behavior should not change because I activated SSL (even though I
> >> don't use it now, our project will require it later)
> >>
> >> So, basically the issue is in a message loop processing I guess
> >>
> >> In our CLIENT application there is a code that opens a form using
> >> SHOWMODAL when it receives a message from the server (Client is
> >> connected to server using our own protocol). As you probably know,
> >> SHOWMODAL will create a windows message loop so application can keep
> >> processing windows messsages. The problem is that apparently when
> >> compiling with SSL, when I call a showmodal from my protocol parser
> >> (that is called from
> >> OnDataAvailable) basically making showmodal being indirectly called
> >> from within the event handler of socket OnDataAvailable, it will not
> >> process any more socket messages while my form is open, although the
> >> application keeps processing all other windows messages it looks like
> >> any socket message (at least data rcv messages) are no longer being
> >> processed and my socket gets "hang" while form called with SHOWMODAL
> is open.
> >>
> >> This behavior occurs only when activating SSL, but if I deactivate
> >> SLL support it will work just fine, and while my form is open with
> >> showmodal, the socket still keeps processing new messages (from
> >> within the message loop created by showmodal calling).
> >>
> >> I guess I know I should not indirectly block OnDataAvailable event
> >> handler by calling a showmodal because of show it works (creates a
> >> new message loop and things can get messy), but this works just fine
> >> without the USE_SSL define, so, I would like to understand why this 
> >> happens.
> >>
> >> I could just disable USE_SSL for now, but I know I will soon need
> >> this is our future release and I just want to understand why this
> >> socket behavior changed and what should be the "correct" way of
> >> working with it
> >>
> >> Thanks
> >>
> >> Eric
> >>
> >
> >
> --
> 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

Reply via email to