亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
rpc 一個實在問題,請教。。。請指點迷經(jīng)。。
[打印本頁]
作者:
wenqing_9115
時間:
2009-04-20 11:23
標(biāo)題:
rpc 一個實在問題,請教。。。請指點迷經(jīng)。。
需要將下面的數(shù)據(jù)結(jié)構(gòu),從client 傳送到server。并在server側(cè)確認(rèn)傳輸成功。
struct cell
{ int data;
struct cell *left,*right;}
struct cell *a,*b,*c,*d;
a=malloc(size of (struct cell));
b=...
c=...
d=...
a->data=1;a->left=b;a->right=c;
b->data=2;b->left=NULL;b->right=d;
c->data=3;c->left=d;c->right=NULL;
d->data=4;d->left=NULL;d->right=NULL;
作者:
wenqing_9115
時間:
2009-04-20 11:30
標(biāo)題:
把我(自己都看不順眼)的代碼貼出來 瞧瞧
send.c
#include<stdio.h>
#include<stdlib.h>
#include<rpc/rpc.h>
#include "send.h"
main(argc,argv)
int argc;
char *argv[];
{
CLIENT *cl,*clnt_create();
char *server;
struct cell *nl;
int *result;
struct cell *a,*b,*c,*d;
a=malloc(sizeof(struct cell));
b=malloc(sizeof(struct cell));
c=malloc(sizeof(struct cell));
d=malloc(sizeof(struct cell));
a->data=1;
a->left=b;
a->right=c;
b->data=2;
b->left=NULL;
b->right=d;
c->data=3;
c->left=d;
c->right=NULL;
d->data=4;
d->left=NULL;
d->right=NULL;
server=argv[1];
cl=clnt_create(server,SENDPROG,SENDVERS,"tcp");
if(cl==NULL){
clnt_pcreateerror(server);
exit(1);
}
result=send_1(&a,cl);
if(*result==0)
printf("error\n");
exit(0);
}
作者:
wenqing_9115
時間:
2009-04-20 11:34
標(biāo)題:
send_proc.c
#include<rpc/rpc.h>
#include<sys/types.h>
#include<stdio.h>
#include "send.h"
int * send_1(cell_a)
struct cell *cell_a;
{
static int result;
FILE *f;
f=fopen("/dev/console","w");
if(f==(FILE *)NULL){
result=0;
return(&result);
}
fprintf(f,"%s\n",cell_a->data);
struct cell *nl;
nl=malloc(sizeof(cell));
while((cell_a->left!=NULL)||(cell_a->right!=NULL))
{
nl->data=cell_a->data;
nl->left=cell_a->left;
nl->right=cell_a->right;
if(cell_a->left!=NULL)
{
send_1(cell_a->left);
}
if(cell_a->right!=NULL)
send_1(cell_a->right);
}
fclose(f);
result=1;
return(&result);
}
作者:
wenqing_9115
時間:
2009-04-20 11:36
標(biāo)題:
send.x
struct cell{
int data;
struct cell *left;
struct cell *right;
};
program SENDPROG{
version SENDVERS{
int
SEND(struct cell *)=1;
}=1;
}=20000006;
作者:
wenqing_9115
時間:
2009-04-20 11:38
gcc -o send_s send.c send_clnt.c send_xdr.c -lnsl
gcc -o send_r send_proc.c send_svc.c send_xdr.c -lnsl
send.r 在遠(yuǎn)端服務(wù)器(qq 服務(wù)器名)運(yùn)行。。
本地執(zhí)行 ./send_s qq
產(chǎn)生一CORE 文件。。。
作者:
urapple
時間:
2009-04-20 11:59
標(biāo)題:
回復(fù) #1 wenqing_9115 的帖子
小弟覺得,與其看半天代碼,不如跟一下core,一根不就知道是哪兒出錯了。
作者:
nicle
時間:
2009-04-20 14:33
標(biāo)題:
回復(fù) #1 wenqing_9115 的帖子
你把一個進(jìn)程中的指針地址發(fā)送到另外的進(jìn)程中, 貌似沒什么用啊
作者:
wenqing_9115
時間:
2009-04-21 15:40
這個 遠(yuǎn)程過程調(diào)用貌似只能用 指針傳遞。。。
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2