Hello Igor, Make a record with same structure in your receiver. Give it the same address as the pointer where you receive data to (with a ReadPtr and WritePtr). Set a flag if you have recieved >= 8 bytes, then you know the length to receive. Allocate enough memory and reallocate if nececary, leve the memory intact to save time, you canuse it for next packet.
> I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER Yes, be prepared that the last data chunck may contain begin of data o next apcket. --- Rgds, Wilfried http://www.mestdagh.biz Monday, August 15, 2005, 18:50, Igor Pokorny wrote: > Well, I would like to thank to all of you tried to help me. I have found > the way how to manage a buffer in TWSchat1.pas (Thank you, Francois). > BTW I would prefer to use Linemode too but I am not allowed to write TCP > client by myself, it's a part of delivered software. > FYI, every packet i obtain to server has a header: > THeader = record > Command:CARDINAL; > Length :CARDINAL; > ChannelFrom:cardinal; > ChannelTo:cardinal; > ChannnelType:CARDINAL; > end; > Command can be "read", "write" or "notify". > Length is probably clear :-) > The client application uses channels for data. Channels can be any type > (bit, byte, word, integer, float, etc. > The group of channels has to be the same type, if the type is "string" > there is allowed to be one channel in the header only. > If the command is "read" the rest of packet (or some nexts) keeps values > of announced channels, if "write" the client send the header only and is > awaiting values of demanding channels (together with the header) and if > command is "notify" it means channels will be changed in short time and > it's up to you what to do (it's mean "to be prepared to deliver new > values ASAP to the second side"}. > I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER > message. Am I right? > Thank again > Igor -- 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