Is there a way to tell if the write buffer is full.

Giganews Newsgroups
Subject: Is there a way to tell if the write buffer is full.
Posted by:  Bob Rasmusens (wjgro…@weir-jones.com)
Date: Fri, 20 Jan 2006

HI,

I am trying to determine if the client side on a server is processing the
information I am sending it fast enough. If there is not enough room in the
write buffer I would like to know this so that I could write information to
another client and not be blocked on the write until the client has
processed enough for the server write to unblock.

Is there a way to do this?
Am I missing something?

The following is my basic code with what I would like to do in the comments:

List := indySocketServer.Threads.LockList;
try
      for loc:=0 to List.Count-1 do
        begin
          AThread := TIdPeerThread(List.Items[loc]);
          {Fill PacketData with data}
          ...
        { If not enough room in write buffer then skip to the next thread
and note this client is not keeping up}

        AThread.Connection.WriteBuffer(PacketData[0],Size,False);

        end;
finally
  indySocketServer.Threads.UnlockList;
end;

Replies