I created a "ebanking.x" file and run it as " rpcgen -a ebaning.x"
It gen a few of files to me which is - "ebanking.h", "ebanking_server.c", "ebanking_svc.c", "ebanking_client.c", "ebanking_clnt.c", "ebanking_xdr.c" and "Makefile"
The content of "ebanking.x" :
struct bankargs {
char usr_id[10];
char usr_name[40];
int usr_account_num;
double balance;
};
program BANKING_PROG {
version BANKING_VERS {
int VIEWBALANCE(bankargs) = 1;
int TRANSFER(bankargs) = 2;
string SYNDATA() = 3;
} = 1;
} = 8431;
I try to add some code in "ebanking_server.c" & "ebanking_client.c" files:
"ebanking_server.c":
char svrname[100];
main(int argc, char* arg[])
{
void* argp;
if(argc<2)
{
printf("Usage: %s <Server Name> \n",arg[0]);
exit(0);
}
strcpy(svrname,arg[1]);
printf("This Server: %s\n",svrname);
}
"ebanking_client.c"
char usr_id[10], usr_name[40];
char *primary;
void clear() {
system("clear");
}
void loadmenu() {
char choice;
int i;
printf("\n\nCurrent user: %s\n", &usr_id);
printf("=================================\n");
printf("1. View Balance 2. Transfer\n");
printf("3. exit (program)\n");
printf("Please enter your choice: ");
scanf("%s", &choice);
if (choice == '1') {
view_balance();
} else if (choice == '2') {
transfer();
} else if (choice == '3') {
printf("Thank you for using the system\n");
exit(0);
}
}
main(int argc, char *argv[])
{
if (argc < 2) {
printf("usage: %s <Type server name>\n", argv[0]);
exit(1);
}
primary = argv[1];
clear();
printf("Please enter User ID: ");
scanf("%s", &usr_id);
printf("Please enter User Name: ");
scanf("%s", &usr_name);
strcat(usr_name, "\n");
while (1) {
loadmenu();
}
}
What doi want to do now? I have tried to compiler it and it prompt error.
type "make" to gen more files and i type "ebanking_server <server name>"
On the othre hand, would you teach me how to make a ebanking_server file after execute, it can still execute and listening for the ebanking_client execute to do some process and ommunication
for instance:
i type "View balance" in client side, server can get the request from client and send the balance to client view
Thank you very much for helping me
Or i post all my files on this site, you can download the files from this file for you to easier for helping me. Thanks
<a href="http://wongalan48.sinaman.com/index.html">
http://wongalan48.sinaman.com/index.html
</a>