home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sgi:12730 comp.unix.wizards:3668
- Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!nj.nec.com!cliff
- From: cliff@research.nj.nec.com (yep just another Xer)
- Newsgroups: comp.sys.sgi,comp.unix.wizards
- Subject: can you set timeout on portmapper clnt_create() ?
- Summary: want to query random hosts with RPC without waiting
- Keywords: rpc clnt_create portmap timeout
- Message-ID: <1992Aug21.180443.14707@research.nj.nec.com>
- Date: 21 Aug 92 18:04:43 GMT
- Sender: news@research.nj.nec.com
- Organization: NEC Research Institute
- Lines: 38
- Originator: cliff@magic
-
- hi,
- i'm writing some packet analyzer/statistics-gathering code. i am trying
- to identify packet types down to the rpc level (i.e. nfs, ypserv, etc.).
- to do this i make a query to the portmapper of each new host that appears
- as a source of new packets, and essentially what i want is to call
- pmap_getmaps(). however, we have a heterogenous network with some PC's
- and Macs on it, and although these machines talk telnet and ftp, they
- don't talk rpc (and hence have no portmapper to talk to). so the program
- hangs whenever a PC or Mac sends a packet, because the program tries
- to establish a connection with the portmapper on the remote host, which
- of course doesn't exist on PC's/Macs.
-
- i know, one way to avoid this is to not make the portmap call to the PC/Mac.
- but what i'd really like to do is to be able to just have a timeout (say
- just 2 seconds instead of the default 25 [who set *that* value anyway??])
- to the call so that if the client doesn't answer, the program can just
- ignore that host and continue functioning. also, i'll need this in case
- i get into a situation of trying to contact the portmapper of a UNIX host
- that just crashed.
-
- i tried to do this, unsuccessfully, by using the "middle level" of rpc,
- with a statement such as cl=clnt_create(argv[1],PMAP_PROG,PMAP_VERS,"udp").
- however, i don't see any way to establish a timeout on the initial
- client creation.
-
- do i have to go all the way down to XDR (ugh!) or am i already making
- the code to complicated? this is my first time programming RPC, so it's
- not too clear if i'm going in the right direction. i succeeded in writing
- a program that duplicates /usr/etc/rpcinfo -p host, but that just uses
- the default interface pmap_getmaps(). clnt_create() works fine if the
- host has a portmapper, but hangs otherwise.
-
- please route any suggestions to cliff@research.nj.nec.com. thanks.
- --
- --
- cliff@research.nj.nec.com 609-951-2688 fax 609-951-2482
- [Cliff Miller, 80% RA, 20% ESA (research associate & ergodic systems-analyst)]
- NEC Research Institute, 4 Independence Way, Princeton NJ 08540
-