We help IT Professionals succeed at work.

Question about INDY component suite in Delphi 6

junnz
junnz asked
on
I am using the TCP server and TCP client suite for communication between two Delphi programs that located in different machines.

When the TCP server haven?t been active in server program, if I attempt to make the TCP client connect to it, the client program will get crash and display the error message - ?Socket Error#10061, Connection Refused?.

I am wondering is there any possibility for the client program to know whether the Host TCP server, which in server program, is active or not before making a connection to it? If this is possible, how can I do it?
Comment
Watch Question

you can use something like this:

try
  Client.Connect;
except
  ShowMessage('Server is not active!');
end;

Author

Commented:
Thanks DragonSlayer.

Using try...except block is a good way to solve this problem. But this is not the way I want, the reason is if you run the programs from delphi IDE, it will still show you the delphi error message first.

Before I accept this solution, I would like to leave this question for a period of time to find out whether there are any other ways to do it.
ah, but you can disable the thingy from Delphi from here:

Tools -> Debugger Options -> Language Exceptions

Uncheck "Stop on Delphi Exceptions"


:)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.