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

www.cryer.info
Managed Newsgroup Archive

writestream() problem..

Subject:writestream() problem..
Posted by:"mustafa korkmaz" (mustafakorkm..@gmail.com)
Date:31 Mar 2007 18:41:19

This is a server program of online gaming and chat
application.It is running for internet users.
Some times any user can not receive package for a long time.
For example after 50 seconds he can receive all packages waiting
in queue.
While this user waits, other users can send and receive messages
without any problem.
And the user who waits the packages can send message to other
users and other users can see
these messages. But this user can not see the messages that
sended other users because he could not
receive first package in his queue yet. All other messages are
wating in queue.
So while 4 users play game together if any player can not
receive one package other 3 users have to wait
this user to play.

Max. sended Package size is 1600 bytes.(this is user picture)
Size of alot of packages are only 10 bytes.


if writestream command is completed in bigger than 3500 ms. my
program writes this information to log file.
So these waiting values are like below:

time:83456 size:11
time:4567 size:9
time:11172 size:1636
time:35234 size:13
time:3689 size:1623
time:13234 size:23
....................


if the user connection is very bad yes it is posible to waits
for a long time until completed the package transfer.
But package size is only 9 bytes and while it waiting this
package it can send properly any package to
server and this package can be seen by other users!! I think
this user's connection is not bad...
May it be about windows? registry value? Or indy settings?

5 server programs are runing on the same machine.Each program is
listening different tcp port.
And 650 users are connected to each program at any time.( 650*5=3250 users )
May each program effect to others while sending Tcp package?
if one program effects to other program which is sending package
why all users dont effect?
While one user waits the package server can properly send packages to other users.

I can not solve the problem...And I can not understand..I can not find source of problem!!


...............
Task := TTask( MyTasklist.items[ 0 ] );
..............

try
criticalnumber := Tmyclient( Task.Athread.data ).criticalnumber;
except
exit;
end;

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;
...............


My system is like below:
windows 2003 server web edition SP1
P4 core 2 duo 2 GB Ram
2 Mbit bandwidth
delphi 5 (update pack 1)
Indy 9.0.18

Replies:

www.cryer.info
Managed Newsgroup Archive