[Gambas-user] server socket problem
guido iodice
guido.iodice at ...626...
Sun May 24 22:27:49 CEST 2009
Hi to all!
I have a problem with server socket.
I made a little http server with Gambas. This server must send large
file, so it read 1KB from the file, write it and wait. The wait is
calculated to fit the max band chosed by the server administrator.
So if the max band is 1KB/s the pause is 1 sec, if band is 2kb/s then
the pause is 0.5 secs.
Now, this is ok.
But if the client is very slow compared with the server band, the
server seems to freeze some second (the gui became unresponsive), then
it work again 1 or 2 second, and again freeze.
I tested this with: wget --limit-rate=1k localhost:65000/filename
This is the code:
WHILE NOT (Eof(myfile))
IF Seek(myfile) + dim_buf <= Lof(myfile) THEN
READ #myfile, b, dim_buf
ELSE
READ #myfile, b, (Lof(myfile) - Seek(myfile))
END IF
WRITE #LAST, b, Len(b)
WAIT pausa ' 1 sec = 1kb/s, 0.5 sec=2kb/s and so on.
WEND
Thank you for your help!
Project page: http://code.google.com/p/bashare/
More information about the User
mailing list