Do you guys know of a way to limit the amount of time will be spent attempting to create a ONC RPC client?
I am currently using the function clnt_create() to create my clients. However, if the remote RPC IP address is not reachable (on different network and unplugged) the GETPORT for portmapper can take 30+ seconds to timeout.
After searching online I found, what I thought was promising, functions like clnt_create_timed() which have a timeout value included but it doesn't appear to affect client creation, just sets the RPC communication timeout. I believe clntudp_create() works in a similar manner.
If you have any suggestions, I would love to hear them.
Thanks,
CoryC
Which ONC are you using? TS-RPC or TI-RPC? If you are unsure, the following shows the differences between the two: http://www.fpmurphy.com/public_html/ONCRPCSurvey2001.pdf
Unfortunately, then there is no way to set timeout on clnt_create(). The only thing I can suggest is to programatically ping the remote host prior to calling clnt_create(). However this check will not work if the remote host is configured to ignore ICMP ECHO requests.
You cut me real deep just now, fpmurphy.
I will consider the ping approach.
I haven't heard of the TI version of RPC but might considering revising my approach. Would an issue arise if a client were TS and server TI (or vice versa)?
Thanks for your help!
Jim,
I attempted that without luck, although I may not have possessed the necessary libraries. I took the source code from a website and it worked the same as clnt_create. The website that contains the source is listed below. I suspect that the function may be of the TI variety.
clientlib: clnt_create_timed.c Source File
It is a few years since I actually get down into the guts of RPC but I believe the answer is no. The on-the-wire protocol is the same.