UNSW   Faculty of Engineering PRINT VERSIONSITE MAP  
cse | School of Computer Science and Engineering (CRICOS Provider No. 00098G)
    #About CSE     #Undergraduate Study     #Postgraduate Study     #Timetables & Courses     #Research & Publications     #People & Work Units     #Help & Resources     #News & Events     #High School Portal

Last updated 19.03.09

Distributed Systems [COMP9243]

Exercises: Sun Remote Procedure Call


Before asking questions regarding this exercise, please review the lecture notes of Week #01 and #02 as well as the documentation linked to on this page.

Sun Remote Procedure Call

Use Sun RPC to implement a simple file server. The file server should implement simple functions that allow clients to read from and write to files hosted on the server. It is up to you whether you want to make the server stateful or stateless.

Developing software using sun RPC

  • Write an XDR interface definition. For example:
    > cat date.x
    program DATE_PROG { 
      version DATE_VERS { 
          long BIN_DATE(void) = 1; 
          string STR_DATE(long) = 2;
      } = 1;
    } = 0x31234567;
    
  • Generate stub code, client and server templates, and a Makefile (on Mac OS X rpcgen doesn't generate a Makefile):
    > rpcgen -Ca date.x
    > ls
    Makefile.date  date.x         date_clnt.c    date_svc.c
    date.h         date_client.c  date_server.c
    
  • Edit the client and server templates (date_client.c, date_server.c)
  • Build:
    > make -f Makefile.date
    
  • Run the server
    > ./date_server
    
    (Note: On Mac OS X I found that I had to start the server as root with sudo)
  • Run the client
    > ./date_client localhost
    

More documentation

A nice set of slides that gives a good overview of XDR data types and other RPC programming issues.

If you want more detailed information, Part 2 of the Sun Network Interfaces Programmer's Guide has all the information you'll ever want about RPC programming.


COMP9243, School of Computer Science and Engineering, University of New South Wales CRICOS Provider Number: 00098G

This page is maintained by cs9243@cse.unsw.edu.au Last modified: Thursday, 19-Mar-2009 17:18:53 EST

Top Of Page

 ###
Site maintained by webmistress@cse.unsw.edu.au
Please read the UNSW Copyright & Disclaimer Statement