Farhan,
   I'm posting a copy of this message to the list
because I think other members can offer good help for
you to migrate your application to ICS.

   The TWSocket component communicates with the
WinSock API at the lowest levels, and therefore it
may seem more complicated to deal with than other
more "abstracted" components.  However, this is
precisely the reason it is so powerful, flexible and
efficient.

   If I understand your question correctly, you want
to send a stream of data of arbitrary length, or at
least be able to send a large string without having
to worry about buffer size or re-building the packets
on the receiving end.  You can do this quite easily
by enabling "LineMode" and setting a very large
number as the maximum line length (ideally, the
maximum that your data can be).  What this will do is
make TWSocket receive all data packets and build the
original string completely before triggering the
OnDataAvailable event.  Therefore, when the event is
finally triggered, you are guaranteed to have the
entire data.

   The only other thing you need to select an
appropriate delimiter string or character that will
let TWSocket know when end of the data has been
received.  Typically, for the higher-level Internet
protocols (such as FTP, SMTP, POP3, etc), a
combination of Carriage-Return and Line-Feed (#13#10)
serves as the line delimiter.  But for binary
transfers, you may want to pick something that you
can be sure to *not* exist in your data stream.  It
can be a single control character or a combination,
as long as you can be sure it will not occur on your
data.

   So, you set LineMode to true, LineLimit to a very
high value (or the length of the data itself), and
LineEnd as the end-of-data delimiter, then call
SendLine() with the string you want to send:

   StrData           := 'This is the data you want to
send';
   StrEnd            := #0#0;
   WSocket.LineMode  := True;
   WSocket.LineLimit := 6553; // Length(StrData) +
Length(StrEnd);
   WSocket.SendLine(StrData);

   Let me know if you need any more help with this.

   -dZ.

>------- Original Message -------
>From    : Farhan
Anwar[mailto:[EMAIL PROTECTED]
>Sent    : 12/5/2007 1:23:23 PM
>To      : [EMAIL PROTECTED]
>Cc      : 
>Subject : RE: ICS
>
 >

FARHAN ANWAR


Yes Sir 
        i have a question That will help me to
convert The Project.If u can Answer then here is my
question.
In TSockets We can Send As Many data as we can In One
line of Code.But In TWSocket We hae to Set the Buf
Size,and at the receiving side we get te data in
Small packets,or some thing like that.How can i
assume that the data i got is the Continued Data
sequence and what is the length of the actual data,or
simply how can we send and receiove stream




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