Dear

In sometimes, i must restart my Linux daemon by killing the process.
But after restart it is not able to bind cause error number 98 "Address 
already in use"
The process must wait few seconds in order to bind the define port...

I have created a loop in order to try to rebind the port but i think iti 
is dirty...
Is there another way to prevent this problem :

../..
var
  ClientSock:TSocket;
begin
  with sock do begin
      setLinger(true,10);
      bind('0.0.0.0',40743);
      if lastError>0 then
          //prevent "Address already in use"
             if lastError=98 then begin"
                    repeat
                        sleep(5000);
                        setLinger(true,10);
                         bind('0.0.0.0',40743);
                  until lastError<>98
         end;
     
      listen;
    
      repeat
        if terminated then begin
           break;
        end;
f canread(1000) then begin
            ClientSock:=accept;
            if lastError=0 then begin
               TTCPHttpThrd.create(ClientSock);
            end;
        end;       
    .../...

best regards


-- 
David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 
FreePascal-Lazarus,perl,delphi,php icq:160018849

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to