Hello Werner,

> so far I've red that after the connect,
> onDataAvailable will fired direct, but is this when also when no data comes
> in?

That was the case on NT4 and on W2K, never checked it on XP. But I
should nor rely on this. Just send your data in OnSessionConnected and
set a timer. When OnDataAvailable fires with data you destroy the timer.
When Timer expire you close the connection.

Or even better: create the timer when you connect, then yoiu have
timeout for the whole cycle.

Note that timers are not unlimited resources.

---
Rgds, Wilfried [TeamICS]
http://www.mestdagh.biz

Wednesday, October 19, 2005, 13:05, Werner wrote:

> Thank,

> Thanks, I'll check the receive function

> An other Q. about TimeOut
> After connect to the server, I send a string 'SENDDATA'
> In OnDataAvailable, i check for incoming data, but when no data arives, then
> I want to close the connection.
> Now I'm using a separate timer to check this.
> Is there an other way to do this, so far I've red that after the connect,
> onDataAvailable will fired direct, but is this when also when no data comes
> in?

> Thanks
> Werner




> ----- Oorspronkelijk bericht ----- 
> Van: "Wilfried Mestdagh" <[EMAIL PROTECTED]>
> Aan: "ICS support mailing" <twsocket@elists.org>
> Verzonden: woensdag, oktober 19, 2005 10:46
> Onderwerp: Re: [twsocket] Socket - streams


>> Hello Werner,
>>
>> If you data has a terminating character then you can use lineMode. Then
>> OnDataAvailable will only fire when thes character(s) are received and
>> you have all your data at ones.
>>
>> If not it will arrive in many chunck, or datapackets can even be
>> concatenatied. Thats nature of TCP.
>>
>> > Now, I'm using CliSocket.ReceiveStr to recieve data and put this
>> > in a buffer until all data is read
>>
>> That is the right way to do if you dont have terminating characters.
>> Better is to use Receive, then you save an extra copy to a string.
>>
>> ---
>> Rgds, Wilfried [TeamICS]
>> http://www.mestdagh.biz
>>
>> Wednesday, October 19, 2005, 10:18, Werner wrote:
>>
>> > Hi,
>>
>> > Does twSocket has a method to use streams
>> > I want to recieve some data in a TStringStream
>>
>> > Now, I'm using CliSocket.ReceiveStr to recieve data and put this in a
> buffer until all data is read
>> > I wonder if I can read all data in one piece by using streams?
>>
>> > Thanks for any suggestions
>> > Werner
>>
>> -- 
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>>
>>


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to