Hi François

Merry Christmas to you, your family and all the ones you love.

________________________________________________________________________

Thank you for your answer about the range check error that occurs

in your unit OverbyteIcsWSocket.pas (version 8.06), function TCustomWSocket.Send at line PostMessage(Handle, FMsg_WM_ASYNCSELECT, FHSocket, IcsMakeLong(FD_WRITE, 0)); [resaon FHSocket=-1].


I totally agree with you, every range check error is something to avoid ;-).
(As this one happens in your code, I thought you might be interested in.)


For me it works with adding

"if FHSocket <> -1 then"
PostMessage...

to your code.

________________________________________________________________________

You might as well type cast (your answer, dec 22 2013) FHSocket -> WParam( FHSocket ). Then no range check error occurs. But then you just send a FMsg_WM_ASYNCSELECT which will be handled in your

procedure TCustomWSocket.WMASyncSelect(var msg: TMessage);

by

  if msg.wParam <> WPARAM(FHSocket) then
       Exit;
________________________________________________________________________

I prefer not to send PostMessage to the message queue.



Thank  you a lot for ICS.


Best regards
Michael




------------------------------

Message: 2
Date: Sun, 22 Dec 2013 16:55:38 +0100
From: Fran?ois Piette <francois.pie...@skynet.be>
To: "'ICS support mailing'" <twsocket@lists.elists.org>
Subject: Re: [twsocket] unit OverbyteIcsWSocket.pas, version 8.06 -
range check error
Message-ID: <00e201ceff2e$43e6a2d0$cbb3e870$@skynet.be>
Content-Type: text/plain; charset="iso-8859-1"

When I send data using the send method, XE5 sometimes reports a
RangeCheckError
in function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) :
Integer;
at line
     PostMessage(Handle,
                   FMsg_WM_ASYNCSELECT,
                   FHSocket,
                   IcsMakeLong(FD_WRITE, 0));

Reason: FHSocket is -1

Maybe it's  by design (?). If you need  further infos then please let me
know.

FHSocket is -1 when the socket has been closed. This is not an issue but to
avoid the error, FHSocket should be cast to WParam like this:

     PostMessage(Handle,
                   FMsg_WM_ASYNCSELECT,
                   WParam(FHSocket),
                   IcsMakeLong(FD_WRITE, 0));

Let me know if it works for you.

--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com





--
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