tags:

views:

441

answers:

1

I am want to have controlled if my rmiport is available and I can have my connection or if it is busy, not available or wathever. I know if it cannot connect it is shown an exception message, but I would like to have it under control, so if it cannot connect I want to show a message like "Connection Failed" and stop the process. (I am working with Eclipse) is it possible?

Thanks in advance!

+2  A: 

Generally you cannot control ports, its sort of a first come first served. If you want to listen at a port say 3306, just try and open a server socket on it, if the process of binding fails its because its already in use.

RMI runs at a specific port, and so perhaps your question is about client side sockets in which case you only need to make sure that the RMI service is running?

Assuming u want to find out if RMI is running, u cud try establishing an RMI service at that port, if it fails because of a "Refused to connect" Exception, then RMI is not running

Ngetha