![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to program a telnet client? | thinker130 | High Level Programming | 8 | 05-08-2008 09:38 PM |
| Server client program | pip3r | High Level Programming | 9 | 04-16-2008 10:15 PM |
| Client - server program | mathu | High Level Programming | 4 | 09-17-2006 09:56 AM |
| Chat client-server program | powermind | High Level Programming | 1 | 09-04-2006 08:19 AM |
| program to transfer a file from client machine to server | nathgopi214 | High Level Programming | 3 | 07-04-2006 03:16 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Client and Server program gen by Makefile
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" : Code:
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;
"ebanking_server.c": Code:
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);
}
Code:
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();
}
}
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> Last edited by blowtorch; 03-05-2007 at 10:08 PM. |
|||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|