BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

About TIdTCPClient receive buffer...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket)
View previous topic :: View next topic  
Author Message
Umberto Spagnoli
Guest





PostPosted: Thu Mar 01, 2007 9:01 pm    Post subject: About TIdTCPClient receive buffer... Reply with quote



I'm using Indy components provided with BDS 2006 (v. 9.0.50)

How can I know how many bytes I currently received in the input buffer of my
TIdTCPClient component without reading the buffer?

Thanks in advance for your replies
Umberto
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 01, 2007 10:05 pm    Post subject: Re: About TIdTCPClient receive buffer... Reply with quote



"Umberto Spagnoli" <jumby (AT) tiscali (DOT) it> wrote in message
news:45e6eac2$1 (AT) newsgroups (DOT) borland.com...

Quote:
How can I know how many bytes I currently received in the
input buffer of my TIdTCPClient component without reading
the buffer?

TIdTCPClient derives from TIdTCPConnection, which has an InputBuffer
property, which in turn has a Size property.

Note that data is not put into the InputBuffer until you call one of
TIdTCPConnection's reading methods first. If you want to know how
many bytes are pending in the socket's internal receive buffer, then
you have to use the ioctlsocket() API function directly for that.


Gambit
Back to top
Umberto Spagnoli
Guest





PostPosted: Fri Mar 02, 2007 12:13 am    Post subject: Re: About TIdTCPClient receive buffer... Reply with quote



Please, could you post a sample code using ioctlsocket() API function ?
I was not able to find any example....

Thanks in advance


Quote:
If you want to know how
many bytes are pending in the socket's internal receive buffer, then
you have to use the ioctlsocket() API function directly for that.


Gambit

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Mar 02, 2007 2:09 am    Post subject: Re: About TIdTCPClient receive buffer... Reply with quote

"Umberto Spagnoli" <jumby (AT) tiscali (DOT) it> wrote in message
news:45e717b9$1 (AT) newsgroups (DOT) borland.com...

Quote:
Please, could you post a sample code using ioctlsocket() API
function ?


u_long bytes = 0;
if( ioctlsocket((SOCKET)IdTCPClient1->Socket->Binding->Handle,
FIONREAD, &bytes) == 0 )
{
// bytes specified the number of unread bytes in the socket's
internal buffer...
}

Typically, you should need to use the socket API directly when using
Indy, though. An alternative approach is to simply call the
connection's ReadFromStack() method to read all pending data into
Indy's InputBuffer, ie:

if( IdTCPClient1->ReadFromStack(true, 0, false) > 0 )
{
// pending data was read ...
}


Gambit
Back to top
Umberto Spagnoli
Guest





PostPosted: Fri Mar 02, 2007 2:20 am    Post subject: Re: About TIdTCPClient receive buffer... Reply with quote

Great!

Thank you very much for your help
Umberto
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.