Re: [twsocket] Bug in TCustomWSocket

2011-04-21 Thread Arno Garrels
Éric Fleming Bonilha wrote:
> HI
> 
> I don´t know if this bug was already fixed on newer releases of
> TWSocket, if yes, sorry for the mail 

Éric,

Thanks, I just checked in rev. #700.

-- 
Arno Garrels


> 
> On unit OverbyteIcsWSocket
> 
> procedure TCustomWSocket.SetSocketRcvBufSize(BufSize : Integer);
> var
> iStatus : Integer;
> optlen  : Integer;
> begin
> optlen  := SizeOf(BufSize);
> {$IFDEF CLR}
> iStatus := WSocket_setsockopt(FHSocket, SOL_SOCKET, SO_RCVBUF,
>   BufSize, optlen);
> {$ELSE}
> iStatus := WSocket_setsockopt(FHSocket, SOL_SOCKET, SO_RCVBUF,
>   PAnsiChar(@BufSize), optlen);
> {$ENDIF}
> if iStatus = 0 then
> FSocketSndBufSize := BufSize
> else
> SocketError('setsockopt(SO_RCVBUF)');
> end
> 
> if iStatus = 0 then
>   FSocketSndBufSize...
> 
> You are storing the buf size on the wrong variable, it should be
> FSocketRcvBufSize 
> 
> 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


Re: [twsocket] HTML encoding to char

2011-04-21 Thread Anton S.
>Delphi HTTPApp unit, function HTMLDecode
Wow! I had no idea of this unit, Thanks a lot! HTTP date parsing, Cookies (!), 
entuity en/decoding... THttpCli might take some useful code from this unit :)
But as I see, HTMLEncode touches only special chars. If that's what you need, 
fine. You may also use my function which I wrote for a XML:

const
  XmlCtrlChars = '<>&"''';
  XmlEntities: array[1..Length(XmlCtrlChars)] of TXmlString = ('lt', 'gt', 
'amp', 'quot', 'apos');

// Replaces special chars by entity-codes
function TextToXML(const aText: TXmlString): TXmlString;
var CtrlCharIdx, PrevIdx, CurrIdx: Integer;
begin
  PrevIdx := 1; Result := '';
  CurrIdx := 1;
  while CurrIdx <= Length(aText) do
  begin
CtrlCharIdx := Pos(aText[CurrIdx], XmlCtrlChars);
if CtrlCharIdx <> 0 then
begin
  Result := Result + Copy(aText, PrevIdx, CurrIdx - PrevIdx) + 
'&'+XmlEntities[CtrlCharIdx]+';';
  PrevIdx := CurrIdx + 1;
end;
Inc(CurrIdx);
  end;
  if Result = ''
then Result := aText
else Result := Result + Copy(aText, PrevIdx, CurrIdx - PrevIdx);
end;

If you need full replacement of all entities, I may share that code too but 
it's much bigger (because of all entities declaration)

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


Re: [twsocket] HTML encoding to char

2011-04-21 Thread Anton S.
>You may also use my function which I wrote for a XML:
Ahh, sorry, you need decoding... here's algorythm:
1) Search for &
2) Search for ; after &
3) Get text between & and ; as S
4) idx := AnsiIndexStr(S, XmlEntities);
if idx = -1 then ... // Error or ignore
5) replacement char is XmlCtrlChars[idx+1];

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


[twsocket] XML RPC

2011-04-21 Thread hein
Hi All

Just a quick question. I need to interface to a XML RPC API, but I havent
got the foggiest were to start. Could the ICS possibly assist?

Regards,
Hein


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


Re: [twsocket] XML RPC

2011-04-21 Thread Francois PIETTE

Just a quick question. I need to interface to a XML RPC API, but I havent
got the foggiest were to start. Could the ICS possibly assist?


XML RPC is a remote procedure call (RPC) protocol which uses XML to encode 
its calls and HTTP as a transport mechanism. "XML-RPC" also refers 
generically to the use of XML for remote procedure call, independently of 
the specific protocol.


ICS can help because the transport layer (HTTP) is already there for client 
and server side.


Where to start ? Look here: http://en.wikipedia.org/wiki/XML-RPC
Once you understand the XML formatting, you use ICS to transport it.

by the way, unless XML RPC is a requirement, there are much efficient ways 
of doing the same thing. One of the many is by using my other component 
library named MidWare (See my website).


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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


Re: [twsocket] XML RPC

2011-04-21 Thread hein
Thank you Francois

It's unfortunately an existing API I need to interface with. The encoding is
Base64, so I'll need to find a delphi lib to get it back to regular XML. I
was hoping for some autmation with the process, but looks like it's going to
be a few late nights.

Have a good easter all.

Regards,
Hein

-Original Message-
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Francois PIETTE
Sent: 21 April 2011 20:22
To: ICS support mailing
Subject: Re: [twsocket] XML RPC

> Just a quick question. I need to interface to a XML RPC API, but I havent
> got the foggiest were to start. Could the ICS possibly assist?

XML RPC is a remote procedure call (RPC) protocol which uses XML to encode 
its calls and HTTP as a transport mechanism. "XML-RPC" also refers 
generically to the use of XML for remote procedure call, independently of 
the specific protocol.

ICS can help because the transport layer (HTTP) is already there for client 
and server side.

Where to start ? Look here: http://en.wikipedia.org/wiki/XML-RPC
Once you understand the XML formatting, you use ICS to transport it.

by the way, unless XML RPC is a requirement, there are much efficient ways 
of doing the same thing. One of the many is by using my other component 
library named MidWare (See my website).


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


Re: [twsocket] XML RPC

2011-04-21 Thread Francois PIETTE

It's unfortunately an existing API I need to interface with.


No problem. As usual with XML, be prepare to have CPU and memory hungry 
piece of code.



The encoding is
Base64, so I'll need to find a delphi lib to get it back to regular XML.


ICS has the functions to encode and decode base64.


I was hoping for some autmation with the process, but looks like it's
going to be a few late nights.


Use Delphi RTTI for that purpose.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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