Thread View: borland.public.cppbuilder.internet.socket
5 messages
5 total messages
Started by Umberto Spagnoli
Thu, 01 Mar 2007 15:01
About TIdTCPClient receive buffer...
Author: Umberto Spagnoli
Date: Thu, 01 Mar 2007 15:01
Date: Thu, 01 Mar 2007 15:01
7 lines
1100 bytes
1100 bytes
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
Re: About TIdTCPClient receive buffer...
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Mar 2007 16:05
Date: Thu, 01 Mar 2007 16:05
18 lines
1483 bytes
1483 bytes
"Umberto Spagnoli" <jumby@tiscali.it> wrote in message news:45e6eac2$1@newsgroups.borland.com... > 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
Re: About TIdTCPClient receive buffer...
Author: Umberto Spagnoli
Date: Thu, 01 Mar 2007 18:13
Date: Thu, 01 Mar 2007 18:13
14 lines
1243 bytes
1243 bytes
Please, could you post a sample code using ioctlsocket() API function ? I was not able to find any example.... Thanks in advance > 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 > >
Re: About TIdTCPClient receive buffer...
Author: Remy Lebeau (TeamB)
Date: Thu, 01 Mar 2007 20:09
Date: Thu, 01 Mar 2007 20:09
27 lines
1688 bytes
1688 bytes
"Umberto Spagnoli" <jumby@tiscali.it> wrote in message
news:45e717b9$1@newsgroups.borland.com...
> 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
Re: About TIdTCPClient receive buffer...
Author: Umberto Spagnoli
Date: Thu, 01 Mar 2007 20:20
Date: Thu, 01 Mar 2007 20:20
4 lines
1036 bytes
1036 bytes
Great! Thank you very much for your help Umberto
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