This discussion is archived
0 Replies Latest reply: Jun 4, 2011 7:27 AM by 866631 RSS

NFS client test program

866631 Newbie
Currently Being Moderated
I'm trying to write a test program that behaves like an NFS client. The code uses the standard RPC calls to talk to the NFS server. It compiles and runs fine on Linux. On Solaris though I have a problem establishing an RPC client initially.

The test program performs the following operations:

1. Uses the portmapper service on the server to establish the remote port associated with the MOUNT service


1. Creates a socket, sockfd.
2. Uses bindresvport to bind a reserved port to the socket. The port number is in the reserved range (ie 600 to 1000ish).
3. Connects this socket to the server
3. Creates a struct sockadd_in with the appropriate address information for the server in addr
4. Calls clnttcp_create

The following code

client = clnttcp_create(addr, <------- points at the server
program, <-------- MOUNT RPC program number
program_version, <--------- MOUNT RPC program version
&sockfd, <------- connected socket using a reserved port on the local client
0,
0);
if (client == NULL) {
clnt_pcreateerror("clnttcp_create");
}

returns "clnttcp_create: RPC: Remote system error - Address already in use".

So it looks like port 688 (the local port selected say by bindresvport) is already in use ? But that's the whole point, I need to provide cnttcp_create() with a socket that already has a port bound to it.

The same code runs fines on a Suse 11 client talking to Open Solaris 11 server. The same code run as a client on Solaris 11 fails with the above message when talking to either a Suse 11 server or a Solaris 11 server.

Any suggestions what I'm doing wrong? Is this the right forum in which to ask?

many thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points