twsocket@lists.elists.org <twsocket@lists.elists.org>
ICS 8
unit OverbyteIcsWSocket.pas, version 8.06
OS Windows 8.1
Delphi XE5
Target Platform Win32
Hi,
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.
Best regards
Michael
____________________________________________
unit OverbyteIcsWSocket.pas, version 8.06 :
function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) : Integer;
begin
if (FState <> wsConnected) and (FState <> wsSocksConnected) then begin
WSocket_Synchronized_WSASetLastError(WSAENOTCONN);
SocketError('Send');
Result := -1;
Exit;
end;
bAllSent := FALSE;
if Len <= 0 then
Result := 0
else begin
Result := Len;
PutDataInSendBuffer(Data, Len);
end;
if bAllSent then
Exit;
TryToSend;
if bAllSent then begin
{ We post a message to fire the FD_WRITE message which in turn will}
{ fire the OnDataSent event. We cannot fire the event ourself }
{ because the event handler will eventually call send again. }
{ Sending the message prevent recursive call and stack overflow. }
{ The PostMessage function posts (places) a message in a window's }
{ message queue and then returns without waiting for the }
{ corresponding window to process the message. The message will be }
{ seen and routed by Delphi a litle later, when we will be out of }
{ the send function. }
PostMessage(Handle,
FMsg_WM_ASYNCSELECT,
FHSocket,
IcsMakeLong(FD_WRITE, 0));
end;
end;
--
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