Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Apr : Re: writestream() problem..

www.cryer.info
Managed Newsgroup Archive

Re: writestream() problem..

Subject:Re: writestream() problem..
Posted by:"mustafa korkmaz" (mustafakorkm..@gmail.com)
Date:1 Apr 2007 14:26:52

"It is waiting for the stream to reach its max size before
sending it."

sorry I couldnt understand exactly..I think I couldnt explain clearly..
Writer thread like below..


TTask = class
AThread: TidpeerThread;
Stream: TMemoryStream;
.........
end;
...........................

While not terminated do
begin

  if MyTasklist.count <> 0 then
  begin
   try
      Wrong := false;
      Task := TTask( MyTasklist.items[ 0 ] );
      try
       criticalnumber := Tmyclient( Task.Athread.data ).criticalnumber;
      except
       Wrong := true;
      end;

      if wrong = false then
        Entercriticalsection( CriticalArray[ criticalnumber ] );
        try
          if Task.Stream.size < 10000 then
          try
           waittime := gettickcount;
           Task.AThread.Connection.WriteStream( Task.Stream );
           if gettickcount - waittime > 3500 then ThreadExceptionToLog( ' time:' + inttostr( Gettickcount - waittime ) + ' size:' + inttostr( Task.stream.size ) );
          except
          end;
        finally
         LeaveCriticalsection( CriticalArray[ criticalnumber ] );
        end;
   finally
    Free_And_DeletetaskFromList;
   end;
  end;

  sleep( 4 );

end;

"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"mustafa korkmaz" <mustafakorkmaz@gmail.com> wrote in message
>news:460f5daa$1@newsgroups.borland.com...
>
>> my stream does not be greater than 10 K.This line is not importand.
>> I added this line for testing. Importand packages are not greater
>> than 20 bytes.
>
>That is my point.  The code you showed is not sending small packets at
>all.  It is waiting for the stream to reach its max size before
>sending it.  So if your stream is not reaching its max size for
>awhile, the user won't receive anything because the server is not
>sending anything.
>
>
>Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive