Windows

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Re: Multithreaded http...

    5 answers - 1369 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I don't really know what to do with TMemoryStream i need TStringList
    the site isn't that big, so it should be any problem But i still don't
    know how do i convert the recived stream to TStringList ;-(
    Message
    From: "Francois Piette" <francois.piette (AT) overbyte (DOT) be>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Monday, April 18, 2005 9:23 AM
    Subject: Re: Re[4]: [twsocket] Multithreaded http
    in requestDone:
    THttpCli(Sender).RcvdStream
    But how do i convert it to StringList ?
    Convert the received stream to a string list ? Arno told you:
    AStream.Seek(0, sofromBeginning);
    StringList.LoadFromStream(AStream);
    But if you want to convert to a string list for analysis, it is probably
    not the most efficient way
    to do that. You should probably use a TMemoryStream and direction use the
    data in memory :
    var
    P : PChar; // Will point to HTML data (or whatever data you received)
    N : Integer; // Will contains the number of bytes
    begin
    P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
    N := THttpCli(Sender).RcvdStream.Size;
    // Now you can use P and N to analyse the document received. Very
    fast.
    // Don't forget to free the stream when processing is done or you'll have
    a memory leak.
  • No.1 | | 2975 bytes | |

    Before you start your request (before the get) you need to assign the
    receive stream:

    ;

    Then, in the RequestDone, as has been explained, you have the rcvdstream
    to read from:

    var StringList: TStrings;

    StringList:=TStringList.Create;
    THTTPCli(Sender).RcvdStream.Seek(0,soBeginning);
    StringList.LoadFromStream(THTTPCli(Sender).RcvdStr eam);
    //Use StringList
    Stringlist.Free;

    You are getting the access violation because you didnt allocate the stream
    before starting the request.

    Dan.

    Message
    From: "Ann" <abba000 (AT) go2 (DOT) pl>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Wednesday, April 20, 2005 3:05 PM
    Subject: Re: Re[4]: [twsocket] Multithreaded http


    >I don't really know what to do with TMemoryStream i need TStringList

    the site isn't that big, so it should be any problem But i still don't
    know how do i convert the recived stream to TStringList ;-(

    Message
    From: "Francois Piette" <francois.piette (AT) overbyte (DOT) be>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Monday, April 18, 2005 9:23 AM
    Subject: Re: Re[4]: [twsocket] Multithreaded http
    >
    >
    >in requestDone:
    >THttpCli(Sender).RcvdStream
    >>

    >But how do i convert it to StringList ?
    >>

    >Convert the received stream to a string list ? Arno told you:
    >AStream.Seek(0, sofromBeginning);
    >StringList.LoadFromStream(AStream);
    >>

    >But if you want to convert to a string list for analysis, it is probably

    not the most efficient way
    >to do that. You should probably use a TMemoryStream and direction use the

    data in memory :
    >>

    >var
    >P : PChar; // Will point to HTML data (or whatever data you
    >received)
    >N : Integer; // Will contains the number of bytes
    >begin
    >P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
    >N := THttpCli(Sender).RcvdStream.Size;
    >// Now you can use P and N to analyse the document received. Very

    fast.
    >>

    >// Don't forget to free the stream when processing is done or you'll have

    a memory leak.
    >>

    >--
    >francois.piette (AT) overbyte (DOT) be
    >http://www.overbyte.be
    >>
    >>

    >--
    >To unsubscribe or change your settings for TWSocket mailing list
    >please goto
    >Visit our website at http://www.overbyte.be
    >>
    >>

    >
    >
    >
  • No.2 | | 3528 bytes | |

    Dan wrote:

    Before you start your request (before the get) you need to assign the
    receive stream:

    ;

    Then, in the RequestDone, as has been explained, you have the
    rcvdstream to read from:

    var StringList: TStrings;

    StringList:=TStringList.Create;
    THTTPCli(Sender).RcvdStream.Seek(0,soBeginning);
    StringList.LoadFromStream(THTTPCli(Sender).RcvdStr eam);
    //Use StringList
    Stringlist.Free;

    IMH a slightly better solution:

    ('');

    // RequestDone event
    StringList:=TStringList.Create;
    StringList.Text:=TStringStream(THTTPCli(Sender).Rc vdStream).DataString;
    //Use StringList
    Stringlist.Free;

    You are getting the access violation because you didnt allocate the
    stream before starting the request.

    Dan.

    Message From: "Ann" <abba000 (AT) go2 (DOT) pl>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Wednesday, April 20, 2005 3:05 PM
    Subject: Re: Re[4]: [twsocket] Multithreaded http


    >I don't really know what to do with TMemoryStream i need
    >TStringList
    >the site isn't that big, so it should be any problem But i still don't
    >know how do i convert the recived stream to TStringList ;-(
    >>

    >Message From: "Francois Piette"
    ><francois.piette (AT) overbyte (DOT) be>
    >To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    >Sent: Monday, April 18, 2005 9:23 AM
    >Subject: Re: Re[4]: [twsocket] Multithreaded http
    >>
    >>

    in requestDone:
    THttpCli(Sender).RcvdStream

    But how do i convert it to StringList ?

    Convert the received stream to a string list ? Arno told you:
    AStream.Seek(0, sofromBeginning);
    StringList.LoadFromStream(AStream);

    But if you want to convert to a string list for analysis, it is probably
    >>

    >not the most efficient way
    >>

    to do that. You should probably use a TMemoryStream and direction use
    the
    >>

    >data in memory :
    >>


    var
    P : PChar; // Will point to HTML data (or whatever data you
    received)
    N : Integer; // Will contains the number of bytes
    begin
    P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
    N := THttpCli(Sender).RcvdStream.Size;
    // Now you can use P and N to analyse the document received. Very
    >>

    >fast.
    >>


    // Don't forget to free the stream when processing is done or you'll
    have
    >>

    >a memory leak.
    >>


    --
    francois.piette (AT) overbyte (DOT) be
    http://www.overbyte.be

    --
    To unsubscribe or change your settings for TWSocket mailing list
    please goto
    Visit our website at http://www.overbyte.be


    >>
    >>
    >>

    >--
    >To unsubscribe or change your settings for TWSocket mailing list
    >please goto
    >Visit our website at http://www.overbyte.be
    >>
  • No.3 | | 2121 bytes | |

    Ann wrote:
    I don't really know what to do with TMemoryStream i need TStringList
    the site isn't that big, so it should be any problem But i still
    don't know how do i convert the recived stream to TStringList ;-(

    I'm sorry, but I strongly suggest that you learn Delphi by a far smaller
    project before you start a multithreaded HTTP application.

    BTW: This is not a Delphi tutorial list. Find out such basic things by
    yourself. There's an online help, there's the big FAQ Google and there
    are examples in your Delphi directory.

    Arno Garrels

    Message
    From: "Francois Piette" <francois.piette (AT) overbyte (DOT) be>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Monday, April 18, 2005 9:23 AM
    Subject: Re: Re[4]: [twsocket] Multithreaded http

    in requestDone:
    THttpCli(Sender).RcvdStream

    But how do i convert it to StringList ?
    >
    >Convert the received stream to a string list ? Arno told you:
    >AStream.Seek(0, sofromBeginning);
    >StringList.LoadFromStream(AStream);
    >
    >But if you want to convert to a string list for analysis, it is probably
    >not the most efficient way to do that. You should probably use a
    >TMemoryStream and direction use the data in memory :
    >
    >var
    >P : PChar; // Will point to HTML data (or whatever data you
    >received) N : Integer; // Will contains the number of bytes
    >begin
    >P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
    >N := THttpCli(Sender).RcvdStream.Size;
    >// Now you can use P and N to analyse the document received. Very
    >fast.
    >
    >// Don't forget to free the stream when processing is done or you'll
    >have a memory leak.
    >
    >--
    >francois.piette (AT) overbyte (DOT) be
    >http://www.overbyte.be
    >
    >
    >--
    >To unsubscribe or change your settings for TWSocket mailing list
    >please goto
    >Visit our website at http://www.overbyte.be
  • No.4 | | 3310 bytes | |

    So this ruin everything semi-multithreading won't make its role

    Message
    From: "Dan" <Dan_F (AT) Blueyonder (DOT) co.uk>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Wednesday, April 20, 2005 5:45 PM
    Subject: Re: Re[4]: [twsocket] Multithreaded http

    Before you start your request (before the get) you need to assign the
    receive stream:

    ;

    Then, in the RequestDone, as has been explained, you have the rcvdstream
    to read from:

    var StringList: TStrings;

    StringList:=TStringList.Create;
    THTTPCli(Sender).RcvdStream.Seek(0,soBeginning);
    StringList.LoadFromStream(THTTPCli(Sender).RcvdStr eam);
    //Use StringList
    Stringlist.Free;

    You are getting the access violation because you didnt allocate the stream
    before starting the request.

    Dan.

    Message
    From: "Ann" <abba000 (AT) go2 (DOT) pl>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Wednesday, April 20, 2005 3:05 PM
    Subject: Re: Re[4]: [twsocket] Multithreaded http
    >
    >
    >I don't really know what to do with TMemoryStream i need TStringList


    the site isn't that big, so it should be any problem But i still
    don't
    know how do i convert the recived stream to TStringList ;-(

    Message
    From: "Francois Piette" <francois.piette (AT) overbyte (DOT) be>
    To: "ICS support mailing" <twsocket (AT) elists (DOT) org>
    Sent: Monday, April 18, 2005 9:23 AM
    Subject: Re: Re[4]: [twsocket] Multithreaded http
    >
    >
    >in requestDone:
    >THttpCli(Sender).RcvdStream
    >>

    >But how do i convert it to StringList ?
    >>

    >Convert the received stream to a string list ? Arno told you:
    >AStream.Seek(0, sofromBeginning);
    >StringList.LoadFromStream(AStream);
    >>

    >But if you want to convert to a string list for analysis, it is

    probably
    not the most efficient way
    >to do that. You should probably use a TMemoryStream and direction use

    the
    data in memory :
    >>

    >var
    >P : PChar; // Will point to HTML data (or whatever data you
    >received)
    >N : Integer; // Will contains the number of bytes
    >begin
    >P := PChar((THttpCli(Sender).RcvdStream as TMemoryStream).Memory);
    >N := THttpCli(Sender).RcvdStream.Size;
    >// Now you can use P and N to analyse the document received. Very

    fast.
    >>

    >// Don't forget to free the stream when processing is done or you'll

    have
    a memory leak.
    >>

    >--
    >francois.piette (AT) overbyte (DOT) be
    >http://www.overbyte.be
    >>
    >>

    >--
    >To unsubscribe or change your settings for TWSocket mailing list
    >please goto
    >Visit our website at http://www.overbyte.be
    >>
    >>

    >
    >
    >
  • No.5 | | 93 bytes | |

    So this ruin everything semi-multithreading won't make its role
    Please elaborate.

Re: Re: Multithreaded http...


max 4000 letters.
Your nickname that display:
In order to stop the spam: 1 + 0 =
QUESTION ON "Windows"

EMSDN.COM