PDA

View Full Version : Stack leak in ReadClientSocket?


Serban
23 Jul 07, 11:30 AM
Hoi all,

Just stared to use clipsal in my house and im making a video/audio page inside piced. I made a server app on my computer to handel all the requests from my toutchscreen. All wordk great but after a while piced gives an out of memory error.

It seems to happen every time i use the 'ReadClientSocket' function.
Is this a bug or am i doing something wrong?

The code im justing works like this:


if not ClientSocketConnected then
OpenClientSocket('127.0.0.1', 23);

if ClientSocketConnected then
begin
writeln('client connected');
repeat
ReadClientSocket(s, #13#10);
if s <> '' then
begin
writeln(s);
WriteClientSocket(s);
WriteClientSocket(#13#10);
end;
until s = '';
end;

I also tried to do the same thing while making the server a host and the error doesnt accour:

if not ServerSocketActive then
OpenServerSocket(23);

if ServerSocketActive then
begin
writeln('im a server');
if ServerSocketHasClient then
begin
writeln('i have a client');
repeat
ReadServerSocket(s, #13#10);
if s <> '' then
begin
writeln(s);
WriteServerSocket(s);
WriteServerSocket(#13#10);
end;
until s = '';
end;
end;

Am i missing some kind of cleanup function for the 'ReadClientSocket' function?

Christian
26 Jul 07, 09:45 AM
Just make the touch screen the server and the computer the client.

This should fix your problem.

Darren
06 Aug 07, 02:11 PM
There is a slow memory leak with the ReadClientSocket function. This will be fixed in the next version (don't ask when).