Sendstream(raw) is just loop (symbolic code):

repeat
        read buffer from the stream
        sendstring(buffer)
until not eof

BTW: opposite function to sendstream is not recvpacket in case of 
TCP. RecvPacket just read what is in the systrm buffers now. It can 
be something different then what is sended by one SendString call. 
(It is very common error.)

Lukas

> 
> 
> background:
> 
> i made a simple tcp/ssl send/receive client/server using fpc/synapse
> 
> i started off using sendstring/recvpacket for sending stuff but while it 
> works okay for simple typing text and text files and fpc runcommand results 
> it gave bad 'binary' files (tgz png pdf etc)
> 
> so since going through
> http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html
> was a bit overkill for information to use to figure out what to use
> 
> so looking around for a solution and finding
> https://forum.lazarus.freepascal.org/index.php?topic=31488.0
> https://stackoverflow.com/questions/30778703/lazarus-freepascal-synapse-send-file-to-tcpblocksocket
> 
> so now i use sendstreamraw(fs); // tstreamemory  for sending 'binary' files
> and everything is fine
> 
> ---
> 
> my question:
> 
> since the most common use of the program will be sending text files and using 
> the sendstreamraw method with tfilestream works just as well as sendstring 
> (from working vs not working viewpoint only) and thinking on simplifying the 
> code to just use sendstreamraw for sending text files (treating all files as 
> a single class of files rather then as text vs binary)
> 
> is creating the tfilestream then using sendstreamraw
> fs := tfilestream.create(s, fmOpenRead);
> a more or less efficient method then just reading the file into a variable 
> and then using sendstring
> 
> any information on limitations/benefits/synapse internals/fpc compiler 
> internals/timing  etc of using the sendstreamraw vs sendstring methods would 
> be appreciated
> 
> ---
> 
> 
> _______________________________________________
> synalist-public mailing list
> synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public



-- 
Lukas Gebauer.

http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.
https://www.geoget.cz/ - Geocaching solution



_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to