Pete Williams wrote:
> My client wants to sometimes connect to the server, send a few lines
> of data, and then disconnect.
> 
> When I want to send data this is what I do
> 
> procedure sendData(asMessage: string);
> begin
>     mystringlist.add(asMessage);
>     if mytwsocket.state <> wsConnected then
>     begin
>        mytwsocket.addr := '127.0.0.1'; // client and server are on
> same machine
>        mytwsocket.port := '17072';
>        mytwsocket.connect();
>     end;
> end;

Next event that fires will be OnSessionConnected.
in OnSessionConnected you can safly send data. 

> 
> Then I have handlers for OnSessionAvailable 

Connecting TWSockets will never fire this event,
instead assign OnSessionConnected at the client-side.
OnSessionAvailable triggers on listening TWSockets only.


> and OnDataSent.

> OnSessionAvailable doesn't seem to get called ever.

OnDataSent is usefull to send large data in smaller chunks.
It's always called when the internal send buffer became empty.

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

Reply via email to