rajesh wrote:I want Individual responses to individual clients . Actuall my server is listenning on particular port .
each client connect with the server at this port .I send him some data continously.
The code I directed you to will be able to handle that. Each client has its own TMemoryStream cache allocate to it, and the OnClient... events are fired for individual clients independant of the other clients.
rajesh wrote:I have a database in which 30 column and 100 rows . data in database is changing randomly . 50 -100 values
continously every 100 ms . so what I am doing I am using a Timer of 100ms . and see data change in database
and if any change in the field in database I send the data to all connected client through loop defined above
and my data packet is only 50 bytes buffer .
It does not matter how large your messages are. Blocking can occur at any time for any byte size. It depends on the particular state of the socket at the time SendBuf() is called. Please study the code snippet I directed you to. The last portion of the code demonstates broadcasting a message to all connected clients, caching and all. I have used that approach in actual projects and it works fine when multiple clients are involved.
rajesh wrote:but sendbuf return -1 randomly for any clients.
I explained that in my previous reply. That is perfectly normal behavior for non-blocking sockets. Your code is just not handling it the way it needs to be handled yet.
rajesh wrote:suppose on any tick to timer it returns -1 for some clients and on another timer tick it return -1 for
another clients .
That is normal. You need to handle it on a per-client, per-send basis, as I have already dmonstrated to you.
rajesh wrote:I am using non blocking sockets.
That is exactly why you are getting into this situation in the first place. The -1 result means you are performing a blocking send at that moment, because the socket is still busy dealin with earlier data. You need to detect and handle the -1 correctly, as I explained to you earlier, in order to respect the non-blocking requirement of your sockets.
rajesh wrote:can you tell me where should I write the code for sending data to clients
I already did, in my previous reply. Please re-read it again, more carefully.