Wilfried you are a total star. If you are ever in Edinburgh I'll buy you a cake (or a whisky) or whatever.
That works! Wilfried Mestdagh wrote: > Hello Pete, > > >> mytwsocket.addr := '127.0.0.1'; >> mytwsocket.port := '17072'; >> mytwsocket.connect(); >> > > that's ok > > >> OnSessionAvailable doesn't seem to get called ever. >> > > No you need OnSessionConnected. OnSessionAvailable is for server > sockets. > > >> In OnDataSent I do this >> > > >> begin >> if mystringlist.count > 0 then >> begin >> mytwsocket.sendStr(mystringlist[0]+#$D#$A); >> mystringlist.delete(0); // we've sent this one >> end else >> begin >> mytwsocket.close(); // no more data to send, so close >> end; >> end; >> > > Not good. you close in OnDataSent. OnDataSent is fired when data is > deliverd to winsock. This does not mean it is delivered to the other end > of the connection. Instead of Close() call ShutDown(1); This will tell > the other end to shutdown after data is delivered. > > but still it is better to make a little protocol so that receiver tell > sender that all data is delivered and handled and it is safe to close. > > >> Should I use threads for my clients as well? >> > > No need to use threading model. you only need threads if you have > lengthy code. > > --- > Rgds, Wilfried [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > http://www.mestdagh.biz > > -- 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
