Lindawb 0 Posted February 17, 2022 Hello, Is this code works with ICS Wsocket ? WSocket1.SendStr('<|START|>' + MemoryStreamToString(MyStream) + '<|END|>'); the sends without error, but on the server OnDataAvailable( Sender : TObject; Error : Word); Cli := Sender as TMyClient; Cli.LineMode := False; Cli.LineEdit := False; Cli.LineLimit := 99999999; sentstream:=Cli.ReceiveStr(); not working , not getting complete stream length. any help appreciated Thank you Share this post Link to post
Angus Robertson 574 Posted February 17, 2022 You are told previously that OnDataAvailable is called repeatedly, each time returning up to a few thousand bytes of data, you only know all the data has arrived when the connection is closed or your protocol says so. You have been advised to use proper high level components that do this work for you, but you seem to want to reinvent these components, without listening to our advice. Angus Share this post Link to post
Lindawb 0 Posted February 17, 2022 Thank you for your kind words, I appreciate your time and knowledge. No this is completely different task, I'm trying many ways, I'm asking question , if you know how to do it please help, otherwise please do not insult. what is the wrong with different questions and different ways to do things? also MemoryStreamToString(MyStream) one line code, other way too many lines , I'm trying to find better way Thank you Share this post Link to post
Angus Robertson 574 Posted February 17, 2022 Sorry if you think my replies are insulting. But you are asking the same question more than once, and ignored my previous reply that answered that question, and previous replies that suggested simpler, quicker ways of doing what we think you are trying to do. If you don't want our advice, please don't keep asking for it. Angus Share this post Link to post
FPiette 383 Posted February 17, 2022 > WSocket1.SendStr('<|START|>' + MemoryStreamToString(MyStream) + '<|END|>'); You should split this in 3 sends, you'll avoid the costly operation that concatenates the 3 string and the operation of converting the stream to string. WSocket1.SendStr(<|START|>'); WSocket1.Send(MyStream.Memory, MyStream.Size); WSocket1.SendStr( '<|END|>'); I urge you to carefully read those documentations, in that order: http://wiki.overbyte.eu/wiki/index.php/Asynchronous_Paradigm http://wiki.overbyte.eu/wiki/index.php/Sending_and_receiving_data Share this post Link to post