Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Socket Error

Status
Not open for further replies.

jfreak53

IS-IT--Management
Apr 30, 2004
44
GT
I have a program that I have using the icmp function to ping a couple of ips and a domain. The problem is that every once in awhile it will freeze up the program and give me a socket error box with the error code "11001" and I have to shut it down using the task manager. What I want to do is to encapsulate that error so it will stop freezing on me and either ignore it or popup my own box. How can I do this? I need to place this event handler in some sort of function or procedure so it works for both parts since I'm using this ping in two different areas.

Thanks in advance.
 
Code:
function MyPing: boolean;
//returns false on error  
begin
  try 
    //put your code here;
    result:= true;
  except
    on E: Exception do begin
      MessageDlg('Error: ' + E.Message , MtError, [mbOk], 0);
      //put any other error handling here;
    end;
    result:= false;
  end;
end;

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top