Ver Mensaje Individual
  #2  
Antiguo 18-02-2008
gallipi gallipi is offline
Miembro
 
Registrado: abr 2007
Posts: 29
Reputación: 0
gallipi Va por buen camino
supongo que es porque el readln es bloqueante y hasta recibir un mensaje se queda esperando, entonces, si un cliente se desconecta, el hilo esta en el readln y al perder el socket dara el error ese.

La duda que me queda es que es lo que tengo que hacer cuando un cliente se desconecte, si tengo que lieberar el hilo o simplemente tengo que hacer un exit.

procedure TModuleManager.tcpServerExecute(AThread: TIdPeerThread);
begin
try
mensaje := AThread.Connection.ReadLn;
if mezua <> ' ' then
begin
if mensaje = 'fin' then exit; // DUDA, SI EL CLIENTE DESCONECTA SIMPLEMENTE TENGO QUE HACER UN EXIT O TENGO QUE LIBERAR EL HILO??
mensaje:=mensaje + ',Lagun.dll';
Athread.Synchronize(TareaThread);
end;
except
raise exception.Create('Server');
end;
end;
Responder Con Cita