🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Omar Zelaya Wed, 26 Sep 2007 02:00
Ind9 -> Ind10 Conversion Question
#833
Author: Omar Zelaya
Date: Wed, 26 Sep 2007 02:00
10 lines
1371 bytes
Hi,

I'm converting some code from Indy 9 to Indy 10, i use CurrentReadBuffer() 
to wait and retrieve all data available from the connection, now on Indy 10 
which method or methods can i use instead of CurrentReadBuffer() so i can 
get the same functionality?

Thanks in Advance

Omar Zelaya 
Re: Ind9 -> Ind10 Conversion Question
#740
Author: Remy Lebeau (TeamB)
Date: Wed, 26 Sep 2007 16:55
18 lines
1511 bytes
"Omar Zelaya" <ozelaya2010@hotmail.com> wrote in message
news:46f9bd49@newsgroups.borland.com...

> I'm converting some code from Indy 9 to Indy 10, i use
> CurrentReadBuffer() to wait and retrieve all data available
> from the connection, now on Indy 10 which method or
> methods can i use instead of CurrentReadBuffer() so i
> can get the same functionality?

Call the IOHandler's CheckForDataOnSource() and InputBufferAsString()
methods, ie:

    Connection.IOHandler.CheckForDataOnSource(Timeout);
    Data := Connection.IOHandler.InputBufferAsString;


Gambit
Re: Ind9 -> Ind10 Conversion Question
#741
Author: Omar Zelaya
Date: Thu, 27 Sep 2007 19:18
54 lines
2740 bytes
Thanks,

I allready tried that, but i have some problems with non-windows tcp 
clients(i.e. Mainframes) on Indy10(client gets a timeout), going to make 
more research to find out wich specifc ones doesnt work with Indy10. With 
Indy 9 works with no problems.

this is my for the Server Execute Method,
INDY 9:

ClientSession = (TClientSession*) AThread->Data;
  if (ClientSession != NULL)
   { if (AThread->Connection->Connected())
      { NewData = AThread->Connection->CurrentReadBuffer();
        if((NewData != "")
        ClientSession->NewDataReceived(NewData);
      }
   }

INDY 10
  ClientSession = (TClientSession*) AContext->Data;
  if (ClientSession != NULL)
   { if (AContext->Connection->Connected())
   { 
AContext->Connection->IOHandler->CheckForDataOnSource(AContext->Connection->IOHandler->ReadTimeout);
  NewData = AContext->Connection->IOHandler->InputBufferAsString();
  if (NewData != "")
     ClientSession->NewDataReceived(NewData);
   }
   }


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:46fa8f40$1@newsgroups.borland.com...
>
> "Omar Zelaya" <ozelaya2010@hotmail.com> wrote in message
> news:46f9bd49@newsgroups.borland.com...
>
>> I'm converting some code from Indy 9 to Indy 10, i use
>> CurrentReadBuffer() to wait and retrieve all data available
>> from the connection, now on Indy 10 which method or
>> methods can i use instead of CurrentReadBuffer() so i
>> can get the same functionality?
>
> Call the IOHandler's CheckForDataOnSource() and InputBufferAsString()
> methods, ie:
>
>    Connection.IOHandler.CheckForDataOnSource(Timeout);
>    Data := Connection.IOHandler.InputBufferAsString;
>
>
> Gambit
>
> 
Re: Ind9 -> Ind10 Conversion Question
#742
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Sep 2007 19:50
33 lines
2211 bytes
"Omar Zelaya" <ozelaya2010@hotmail.com> wrote in message
news:46fc0255$1@newsgroups.borland.com...

> I allready tried that, but i have some problems with non-windows
> tcp clients(i.e. Mainframes) on Indy10(client gets a timeout)

Then the client is likely not sending any data to begin with.  There is
nothing in the code I have given you that can raise an timeout exception.

> going to make more research to find out wich specifc ones doesnt
> work with Indy10.

TCP is TCP regardless of whether you use Indy 9 or 10.  If the data being
sent is the same, then Indy 10 should be working fine for you.

> With Indy 9 works with no problems.

You shouldn't really be checking for Connected() at all, in either 9 or 10.
Let Indy raise an exception when you try to read from a socket that has been
closed.  That will notify the server to shut down the thread for that
connection.

Try this instead:

    ClientSession = (TClientSession*) AContext->Data;
    AContext->Connection->IOHandler->CheckForDataOnSource(IdTimeoutDefault);
    NewData = AContext->Connection->IOHandler->InputBufferAsString();
    if( (NewData != "") && (ClientSession != NULL) )
        ClientSession->NewDataReceived(NewData);


Gambit
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