🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4648

Re: please help me..socket file transfer

#4648
From: Remy Lebeau (TeamB)
Date: Tue, 11 Jan 2005 21:41
31 lines
2395 bytes
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote in message
news:41e434ae$1@newsgroups.borland.com...

> 1) Make the piece of data by myself, for example
> buffer of 5000 bytes, and always try to send max that
> buffer, etc, etc.
>
> 2) Try to send all the buffer, and via the return value
> we see what piece (how many bytes) is actually sent,
> so we can track where we are supposed to continue.

The size of the buffering does not matter.  The socket will always return
how much data was actually accepted.  Even if you use a fixed-size buffer,
the socket may not accept the full buffer at one time, so you would have to
re-sent the remaining buffer before then re-filling the buffer with the next
block of data.

> Am I right, or I mixed something?

There are times to use both scenerios you described.  If you have direct
access to the original data memory, then #2 is better, as long as the memory
does not change while you are sending it.  Use #1 when you don't have direct
access to the original data memory.  I use both in my earlier example.  I
used #2 to send the stream size since the integer's memory was directly
accessible, and then I used #1 for the stream data since TStream does not
provide directly access to the data (if you use TMemoryStream, you can use
#2, though).


Gambit
Technical Details
Message-ID: <41e44788$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41e3b756@newsgroups.borland.com> <41e41d6a$1@newsgroups.borland.com> <41e434ae$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,399582d307fda7fe
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41e3b756@newsgroups.borland.com> <41e41d6a$1@newsgroups.borland.com> <41e434ae$1@newsgroups.borland.com>
Subject: Re: please help me..socket file transfer
Date: Tue, 11 Jan 2005 13:41:11 -0800
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41e44788$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1105479560 68.69.17.41 (11 Jan 2005 13:39:20 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail