🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
54 messages
54 total messages Page 2 of 2 Started by Alfred Mon, 31 Oct 2005 13:35
Page 2 of 2 • 54 total messages
Re: i need ideas/comments with tclientsocket
#3273
Author: Jonathan Benedicto
Date: Tue, 01 Nov 2005 14:36
12 lines
1740 bytes
Hans Galema wrote:
> So we spoke about different code and did a different test.

Sorry. I changed the code because I realized after I posted my first code 
chunk that I had made an error. Because when only 1 byte was left in the 
socket buffer, 1 / 2 = 0 in a integer, so it was being told to read 0 
bytes. So that is why I changed it.

However, it didn't hang the app, nor show any signes of problems when only 
half-reading available bytes.

Jonathan
Re: i need ideas/comments with tclientsocket
#3274
Author: Remy Lebeau (TeamB)
Date: Tue, 01 Nov 2005 17:11
22 lines
1999 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:4367395a@newsgroups.borland.com...

> Well I have to. But you did not know why

As I said before, the Size property already checks the capacity of the
currently allocated Memory and then reallocates the Memory only when
actually needed.  TMemoryStream has a Capacity property tha indicates the
size of the allocated memory.  That is different than the Size property,
which specifies the number of bytes that are available in the allocated
Memory.  Setting the Size also sets the Capacity, which may be more than the
Size.

> I never size the stream down.

If you don't do that, then the stream will slowly continue allocating more
and more memory until it runs out.  You should reduce the Size periodically
to reduce the amount of unused memory.


Gambit
Re: i need ideas/comments with tclientsocket
#3275
Author: Remy Lebeau (TeamB)
Date: Tue, 01 Nov 2005 17:13
17 lines
1679 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:436739a0@newsgroups.borland.com...

> Where is the AnsiString ?

In Alfred example code:

    Memo->Lines->Add(AnsiString((char*)Data, DataLength));

DataLength ensures that all characters are handled without having to
transmit a null terminator over the socket, and AnsiString always has a null
terminator at the end of its allocated memory (otherwise the char* string
from c_str() would never be terminated).


Gambit
Page 2 of 2 • 54 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads