Don't know but did you "Receive" data before ProcessMessage ? OnDataAvailable will be triggered until you read received data.
Other thing, you should not do such repeat/until upon Send but better use OnDataSent event to manage sending next record(s). IM> Hi, IM> Please look at the code below. IM> . IM> . IM> . IM> try IM> try IM> Query.Open; IM> OnDataSent := DataWasSent; IM> // DataWasSent sets "SentOk" to True IM> while not Query.EOF do IM> begin IM> Rec := PrepareRec(true); IM> Rec.AllDist := Rec.AllDist - D; IM> Rec.Count := RecCount; IM> SentOk := false; IM> Send(@Rec, SizeOf(TRec)); IM> repeat IM> ProcessMessages; IM> until SentOk; IM> Query.Next; IM> end; IM> except IM> on E: Exception do IM> Display(ExecuteCommand1 - %s', [E.Message]); IM> end IM> finally IM> Query.Close; IM> OnDataSent := nil IM> end; IM> The code is executed from OnClientDataAvailable of an TWSocketServer. IM> When the execution reach the "repeat .. until SentOk", on IM> ProcessMessages the code is reentered a second time. IM> What am I doing wrong? IM> 10x, IM> Ionut Muntean -- 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