Sponsored Content
Top Forums Programming [C][RPC][Solaris]Not compiling client/server Post 302587964 by manarina on Friday 6th of January 2012 11:39:12 AM
Old 01-06-2012
[C][RPC][Solaris]Not compiling client/server

Hello,
I have task to make a program that multiplies polynomials as client(input/output indexes)-server(multiplying) using RPC. However when I try to compile it with gcc it gives the next info:

for client:
Udefined first
symbol referenced
Clnt_create client.o

for server:
Udefined first
symbol referenced
mlt_proc_1 mlt_svc.o

What could be done with it?(Some libs problems(?), mb missing some include files?)

here the listings:
mlt.x
Code:
struct mlt_in { /* входные данные (аргумент) */
int f[20];
int g[20];
};

struct mlt_out { /* возвращаемые данные (результат) */
int d[40];
};

program MLT_PROG {
version MLT_VERS {
mlt_out MLTPROC(mlt_in) = 1; /* номер процедуры = 1 */
} = 1;
} = 0x31230000;

client.c
Code:
#include "mlt.h" /*rpcgen */
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/types.h>

CLIENT *Clnt_create(const char *host, unsigned long prognum, unsigned long versnum, const char *protocol);
int
main()
{
int i,j,m,q,r,s;
CLIENT *cl;
mlt_in in;
mlt_out *outp;
cl = Clnt_create("127.0.0.1", MLT_PROG, MLT_VERS, "tcp");
printf("Insert dimension 1\n");
scanf("%i", q);
printf("\nInsert dimension 2\n");
scanf("%i", r);
printf("Insert indexes from 0 to 20");

for(i=0; i<20; i++)
{
scanf("%i", in.f[i]);
printf("%i\t", in.f[i]);
};

printf("Insert indexes from 0 to 20");
for(j=0; j<20; j++)
{
scanf("%i", in.g[j]);
printf("%i\t", in.g[j]);
};

if ((outp = mltproc_1(&in, cl)) == NULL)
printf("error occured");
printf("\n");
for(m=0; m<=(r+q);m++)
{
printf("%i\t", outp->d[m]);
};

exit(0);
}

server.c
Code:
#include "mlt.h"
#include <stdio.h>
#include <rpc/rpc.h>
#include <sys/types.h>


mlt_out *
mltproc_l_svc(mlt_in *inp, struct svc_req *rqstp)
{
static mlt_out out;
int k, i;
int s = 40;
for(k=0; k<=s;k++)
{
out.d[k]=0;
for(i=0; i<=k;i++)
{
out.d[k]=inp->f[i]*inp->g[k-i];
};
};

/*out.d[1] = inp->f[19] * inp->g[19];*/

return(&out);
}

 

8 More Discussions You Might Find Interesting

1. Programming

Creating a client handle in RPC

Hi, I am trying to create a CLIENT handle in RPC on Solaris. I am calling the following function CLIENT *clnt = clnt_create(host, prognum, versnum, nettype); However If I call this in main it seems to work but if I call this function in any other function it fails with a segmentation... (1 Reply)
Discussion started by: pic
1 Replies

2. Linux

NFS Server FC7 Solaris client problems!

Hi, my problem is that I am not able to grand the nfs directory on a Fedora 7 server to a standard solaris client. I always got the messages no permission. Important: No change on the client (Solaris) is possible! So I am not able to change the NFS Version on the client side to force the... (3 Replies)
Discussion started by: joerg
3 Replies

3. Programming

Client/Server Socket Application - Preventing Client from quitting on server crash

Problem - Linux Client/Server Socket Application: Preventing Client from quitting on server crash Hi, I am writing a Linux socket Server and Client using TCP protocol on Ubuntu 9.04 x64. I am having problem trying to implement a scenario where the client should keep running even when the... (2 Replies)
Discussion started by: varun.nagpaal
2 Replies

4. Solaris

RPC: Rpcbind failure - RPC: Timed out error (solaris)

C: Rpcbind failure - RPC: Timed out error (solaris) hello an nfs server on my sun fire v440 is not responding , i get the error bellow and lots of my networking services are not reponding, please helppppp its an emergency RPC: Rpcbind failure - RPC: Timed out i also get NFS server... (2 Replies)
Discussion started by: feg
2 Replies

5. Solaris

Solaris syslog server and client

Hi folks, I am attempting to setup a Solaris 10 syslog server to receive logs from linux machines. Here's what I did: On the server (SunOS sun226 5.10), IP address: 192.168.212.226: 1. start syslogdby issuing $/usr/sbin/syslogd -T On a client (SunOS sun221 5.8): 1. Configured... (1 Reply)
Discussion started by: kimurayuki
1 Replies

6. Red Hat

Nfs client mount RPC Error: Program not registered.

Hello, I was having few issues on my linux box, I am getting this error whenever I tried to mount a share on a client linux host. # mount -t nfs 10.10.4.150:/data/pops_sva /mnt mount: mount to NFS server '10.10.4.150' failed: RPC Error: Program not registered. # I see the error and I... (4 Replies)
Discussion started by: bobby320
4 Replies

7. Solaris

LDAP server and client configuration in Solaris 10

How do i install ldap server and client in solaris server how to configure ldap server and client please help me (1 Reply)
Discussion started by: ainstin
1 Replies

8. Solaris

How to add new Solaris client IP into Solaris 10 DNS server?

Hi, We just built a new Solaris 10 zone. And would like to add it to our DNS server. Its also Solaris 10. Please let me know how can I get the IP resolved using this DNS server. I added entry into zone config file but not working. I did restarted the DNS services. And also added nameserver name... (5 Replies)
Discussion started by: snchaudhari2
5 Replies
RPC_CLNT_CREATE(3)					   BSD Library Functions Manual 					RPC_CLNT_CREATE(3)

NAME
rpc_clnt_create, clnt_control, clnt_create, clnt_create_vers, clnt_destroy, clnt_dg_create, clnt_pcreateerror, clnt_raw_create, clnt_spcreateerror, clnt_tli_create, clnt_tp_create, clnt_vc_create, rpc_createerr -- library routines for dealing with creation and manipu- lation of CLIENT handles LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <rpc/rpc.h> bool_t clnt_control(CLIENT *clnt, const u_int req, char *info); CLIENT * clnt_create(const char * host, const rpcprog_t prognum, const rpcvers_t versnum, const char *nettype); CLIENT * clnt_create_vers(const char * host, const rpcprog_t prognum, rpcvers_t *vers_outp, const rpcvers_t vers_low, const rpcvers_t vers_high, char *nettype); void clnt_destroy(CLIENT * clnt); CLIENT * clnt_dg_create(const int fildes, const struct netbuf *svcaddr, const rpcprog_t prognum, const rpcvers_t versnum, const u_int sendsz, const u_int recvsz); void clnt_pcreateerror(const char *s); char * clnt_spcreateerror(const char *s); CLIENT * clnt_raw_create(const rpcprog_t prognum, const rpcvers_t versnum); CLIENT * clnt_tli_create(const int fildes, const struct netconfig *netconf, const struct netbuf *svcaddr, const rpcprog_t prognum, const rpcvers_t versnum, const u_int sendsz, const u_int recvsz); CLIENT * clnt_tp_create(const char * host, const rpcprog_t prognum, const rpcvers_t versnum, const struct netconfig *netconf); CLIENT * clnt_vc_create(const int fildes, const struct netbuf *svcaddr, const rpcprog_t prognum, const rpcvers_t versnum, const u_int sendsz, const u_int recvsz); DESCRIPTION
RPC library routines allow C language programs to make procedure calls on other machines across the network. First a CLIENT handle is cre- ated and then the client calls a procedure to send a request to the server. On receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends a reply. ROUTINES
clnt_control() A function macro to change or retrieve various information about a client object. req indicates the type of operation, and info is a pointer to the information. For both connectionless and connection-oriented transports, the supported values of req and their argument types and what they do are: CLSET_TIMEOUT struct timeval * set total timeout CLGET_TIMEOUT struct timeval * get total timeout Note: if you set the timeout using clnt_control(), the timeout argument passed by clnt_call() is ignored in all subsequent calls. Note: If you set the timeout value to 0 clnt_control() immediately returns an error (RPC_TIMEDOUT). Set the timeout parameter to 0 for batching calls. CLGET_SVC_ADDR struct netbuf * get servers address CLGET_FD int * get fd from handle CLSET_FD_CLOSE void close fd on destroy CLSET_FD_NCLOSE void don't close fd on destroy CLGET_VERS unsigned long * get RPC program version CLSET_VERS unsigned long * set RPC program version CLGET_XID unsigned long * get XID of previous call CLSET_XID unsigned long * set XID of next call The following operations are valid for connectionless transports only: CLSET_RETRY_TIMEOUT struct timeval * set the retry timeout CLGET_RETRY_TIMEOUT struct timeval * get the retry timeout The retry timeout is the time that RPC waits for the server to reply before retransmitting the request. clnt_control() returns TRUE on success and FALSE on failure. clnt_create() Generic client creation routine for program prognum and version versnum. host identifies the name of the remote host where the server is located. nettype indicates the class of transport protocol to use. The transports are tried in left to right order in NETPATH environment variable or in top to bottom order in the netconfig database. clnt_create() tries all the transports of the nettype class available from the NETPATH environment variable and the netconfig database, and chooses the first successful one. A default timeout is set and can be modified using clnt_control(). This routine returns NULL if it fails. The clnt_pcreateerror() routine can be used to print the reason for failure. Note: clnt_create() returns a valid client handle even if the particular version number supplied to clnt_create() is not registered with the rpcbind(8) service. This mismatch will be discovered by a clnt_call() later (see rpc_clnt_calls(3)). clnt_create_vers() Generic client creation routine which is similar to clnt_create() but which also checks for the version availability. host identi- fies the name of the remote host where the server is located. nettype indicates the class transport protocols to be used. If the routine is successful it returns a client handle created for the highest version between vers_low and vers_high that is supported by the server. vers_outp is set to this value. That is, after a successful return vers_low <= *vers_outp <= vers_high. If no version between vers_low and vers_high is supported by the server then the routine fails and returns NULL. A default timeout is set and can be modified using clnt_control(). This routine returns NULL if it fails. The clnt_pcreateerror() routine can be used to print the reason for failure. Note: clnt_create() returns a valid client handle even if the particular version number supplied to clnt_create() is not registered with the rpcbind(8) service. This mismatch will be discovered by a clnt_call() later (see rpc_clnt_calls(3)). However, clnt_create_vers() does this for you and returns a valid handle only if a version within the range supplied is supported by the server. clnt_destroy() A function macro that destroys the client's RPC handle. Destruction usually involves deallocation of private data structures, including clnt itself. Use of clnt is undefined after calling clnt_destroy(). If the RPC library opened the associated file descriptor, or CLSET_FD_CLOSE was set using clnt_control(), the file descriptor will be closed. The caller should call auth_destroy(clnt->cl_auth) (before calling clnt_destroy()) to destroy the associated AUTH structure (see rpc_clnt_auth(3)). clnt_dg_create() This routine creates an RPC client for the remote program prognum and version versnum; the client uses a connectionless transport. The remote program is located at address svcaddr. The parameter fildes is an open and bound file descriptor. This routine will resend the call message in intervals of 15 seconds until a response is received or until the call times out. The total time for the call to time out is specified by clnt_call() (see clnt_call() in rpc_clnt_calls(3)). The retry time out and the total time out periods can be changed using clnt_control(). The user may set the size of the send and receive buffers with the parameters sendsz and recvsz; values of 0 choose suitable defaults. This routine returns NULL if it fails. clnt_pcreateerror() Print a message to standard error indicating why a client RPC handle could not be created. The message is prepended with the string s and a colon, and appended with a newline. clnt_spcreateerror() Like clnt_pcreateerror(), except that it returns a string instead of printing to the standard error. A newline is not appended to the message in this case. Warning: returns a pointer to a buffer that is overwritten on each call. clnt_raw_create() This routine creates an RPC client handle for the remote program prognum and version versnum. The transport used to pass messages to the service is a buffer within the process's address space, so the corresponding RPC server should live in the same address space; (see svc_raw_create() in rpc_svc_create(3)). This allows simulation of RPC and measurement of RPC overheads, such as round trip times, without any kernel or networking interference. This routine returns NULL if it fails. clnt_raw_create() should be called after svc_raw_create(). clnt_tli_create() This routine creates an RPC client handle for the remote program prognum and version versnum. The remote program is located at address svcaddr. If svcaddr is NULL and it is connection-oriented, it is assumed that the file descriptor is connected. For con- nectionless transports, if svcaddr is NULL, RPC_UNKNOWNADDR error is set. fildes is a file descriptor which may be open, bound and connected. If it is RPC_ANYFD, it opens a file descriptor on the transport specified by netconf. If fildes is RPC_ANYFD and netconf is NULL, a RPC_UNKNOWNPROTO error is set. If fildes is unbound, then it will attempt to bind the descriptor. The user may specify the size of the buffers with the parameters sendsz and recvsz; values of 0 choose suitable defaults. Depending upon the type of the transport (connection-oriented or connectionless), clnt_tli_create() calls appropriate client creation routines. This routine returns NULL if it fails. The clnt_pcreateerror() routine can be used to print the reason for failure. The remote rpcbind service (see rpcbind(8)) is not consulted for the address of the remote service. clnt_tp_create() Like clnt_create() except clnt_tp_create() tries only one transport specified through netconf. clnt_tp_create() creates a client handle for the program prognum, the version versnum, and for the transport specified by netconf. Default options are set, which can be changed using clnt_control() calls. The remote rpcbind service on the host host is consulted for the address of the remote ser- vice. This routine returns NULL if it fails. The clnt_pcreateerror() routine can be used to print the reason for failure. clnt_vc_create() This routine creates an RPC client for the remote program prognum and version versnum; the client uses a connection-oriented trans- port. The remote program is located at address svcaddr. The parameter fildes is an open and bound file descriptor. The user may specify the size of the send and receive buffers with the parameters sendsz and recvsz; values of 0 choose suitable defaults. This routine returns NULL if it fails. The address svcaddr should not be NULL and should point to the actual address of the remote pro- gram. clnt_vc_create() does not consult the remote rpcbind service for this information. struct rpc_createerr rpc_createerr; A global variable whose value is set by any RPC client handle creation routine that fails. It is used by the routine clnt_pcreateerror() to print the reason for the failure. SEE ALSO
rpc(3), rpc_clnt_auth(3), rpc_clnt_calls(3), rpcbind(8) BSD
May 23, 2009 BSD
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy