The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to program a telnet client? thinker130 High Level Programming 8 05-09-2008 12:38 AM
Server client program pip3r High Level Programming 9 04-17-2008 01:15 AM
Client - server program mathu High Level Programming 4 09-17-2006 12:56 PM
Chat client-server program powermind High Level Programming 1 09-04-2006 11:19 AM
program to transfer a file from client machine to server nathgopi214 High Level Programming 3 07-04-2006 06:16 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-05-2007
wongalan48 wongalan48 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 2
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;
I try to add some code in "ebanking_server.c" & "ebanking_client.c" files:

"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);	
}
"ebanking_client.c"
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();
	}
}
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>

Last edited by blowtorch; 03-06-2007 at 01:08 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0