[Webinar] Streamline your web hosting managementRegister Today


How to get infomation about RPC events...

Posted on 1997-04-24
Medium Priority
Last Modified: 2013-12-26
> I am trying to figure out some information like
> when the server sends the events and when the client
> receives from the client/server applications which are
> using RPC libraries.
> Actually, I'd like to trace events between the server and
> client. How can I figure out when the server receive a
> event from the client and what event it is. Vice versa.
> When the client invoke a clnt_call() library, can we know
> what the exact time is ?
> While the server is wating for events at the dispatch
> routine, if a event is arrived, how can we get the time
> and info like what type of events is ?
> Is these possible or not ?
> Please give me some comments ASAP.

> Young W. Cho

Thank you for your answer.
I am so sorry to mislead you to understand my question incorrectly.
The main focus on this problem is that we can figure out
event trace between some processes from the outside of the
related processes.
For example, let's assume that we are debugging or monitoring two processes. Can we get some event trace information from these processes independently, like
what type of events was sent or when that event was received.
I'd like to know those kind of information from the process
without knowing their help independently.
Thanks in advance.

Young W Cho    
Question by:ywcho
  • 4
  • 3

Expert Comment

ID: 1292650
I assume you use ONC RPC. To monitor server events you'll have to write your own RPC main event loop. Could look something like

fd_set readfd;
while ( 1 )
   readfd = svc_fdset;
   FD_SET( 0, &readfd );

   switch (select(getdtablesize(), &readfd, (fd_set*)0,(fd_set*)0,struct timeval *)0))
       case -1:
           if ( errno == EBADF )
           perror( "Select failed" );
       case 0:
   /* get the time here on do what you want with it */
   svc_getreqset( &readfd );

If you need to go even closer you search for the file created by rpcgen that dispatches the calls. It will be xxx_svc.c where xxx is your appname. Different platforms implement the dispatcher different but it should most probably be a switch statement decoding arguments, calling the service routine and encoding the result. Here you should extract the more detailed info such as whether it was a ping request.

For the clnt_call all I can think of is for you to put your monitoring of the time in the stub generated by rpcgen

Hope I understand you question correctly


Author Comment

ID: 1292651
Edited text of question

Author Comment

ID: 1292652
Please take a look at additional explanation for my question.
I am so sorry for you to be misleaded due to drawing my problem

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Accepted Solution

waslap earned 100 total points
ID: 1292653
Only way I can think of now that might give you some vague idea of what is going on from the outside is to truss it ( strace on linux ) as RPC's are most probably built on sockets and thus will use read/write system calls. Apart from that a SUN machine has snoop which may help you to monitor RPC events by running
snoop -i rpc.cap -V | grep RPC
as the root user where rpc.cap is a file dump of the communications session obtained by a previous snoop. You may have accurate time info included as well. Please do 'man snoop' to get more info ( that is if you have access to SUN machine )

Author Comment

ID: 1292654
Thank you for your comments again.
I coudln't find the tools(strace, snoop) that you mentioned.
"ttysnoop" and "strace" are all that I have found on an archive
server, but these are for Linux.
Again, the problem I have faced is that I am looking for
the way to figure out who sent the event and which event a client
sent, if server received an event. I'd like to do this out side of these processes. If we can do this in the middle of debugging,
it could be possible. I have tried to do on debugging. I could find where an event was sent from the tranport(SVCXPRT), but I couldn't who sent it(which process).
In the server side, I could get the port number of a client process, but I couldn't identify the process with that port number in the client side.
Is there any way to identify a specific process with the port number ?

Thanks in advance.

Young W Cho

Expert Comment

ID: 1292655
strace is the linux equivalent of truss as found under Unix normally. ttysnoop wouldn't help you as it is used to see what someone is typing on his terminal at present. Under linux, the SVCXPRT structure has the member
struct sockaddr_in xp_raddr;
The macro in svc.h
#define svc_getcaller(x) (&(x)->xp_raddr)
is said to be the approved way to access that member. It contains both the IP and port. Use inet_ntoa() to convert to human readable form. This is however to get the address and not the pid. I assume your testing client and server on same machine. I'm not sure whether I understand your problem correct still. You have access to the sources or are you trying to figure out what some app does for which you don't have source ? Only way then is to have packet monitor such as SUN's snoop application. If you want pid and you have access to sources, maybe you can add pid field to your XDR structs and send pid along with rest of request. Use getpid() to get the process's pid.
Hope it helps

Author Comment

ID: 1292656
Thank you for your comments.
My testing client and server are running on different machines.
Also I coouldn't use struss since it couldn't get information from the process debugged.
Actually, I am trying to develop a tool which inspects a process and finds out who sent this event if the process received an event at its dispatcher routine. But I don't want the source code
of the process. As you mentioned before, we can get the address and the port number of a client. However, I can't identify the client process with the port number. If we can get the port number of the client process when the clnt_call() is invoked,
I could identify the client process through comparing the port number received in the server and it of the client.
I am so sorry to disturb you for long time.
Please give me a idea if you have.
Have a nice day.

Young W Cho


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question