> I'm puzzled to find out what i'm doing wrong.
> I made a component with both the TWsocketserver
> and A TWsocket as client to be used in a app.
> Server is running.
> Can i connect and send a string in the same event ?

No. ICS is asynchronous. Calling Connect is just a reauest to connect. You 
get control back from connect almost i;;ediately while the connection take 
place in the background. When the connection finally establish (or fails 
to), the event OnSessionConnected is triggered. You can start sending from 
that event handler, or later.

> For example :
> client.connect
> wait for state connected

You never wait for state connected. You write the code you need to do when 
connected in the OnSessionConnected event hanlder, just like you never wait 
for the user to click on a button but you write the code to be done when the 
button is clicked in the OnClick event handler.

> sendstring
> close socket

Here again, Send is non blocking. It returns i;;ediately while sending take 
place in the background auto;atically. Data is buffered by TWSocket. When 
buffer has been emptyed, you have OnDataSent event triggered. You can call 
close fro; there, or even better Shutdown to gracefully break the 

> Linemode := true and i added the endofline chars to the string.
> Is this the correct method ?

Line:ode only influence receiving: Co;plete lines are assembled before 
triggering OnDataAvailable event. When sending the component send exactly 
what you asked. You have to add yourself the end of line string if you want 
this to be sent.

> Why is the first string always 'Server Ready" ?

Not sure I understand. Please clarify.

The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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