Client and Server program gen by Makefile


 
Thread Tools Search this Thread
Top Forums Programming Client and Server program gen by Makefile
# 1  
Old 03-05-2007
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..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Error when run makefile to compile C program

I have a make file for C program, which always gives the error ld: 0711-738 ERROR: Input file ../src/file_name.o XCOFF32 object files are not allowed in 64 mode Does anybody know the problem? Thanks for contribution (2 Replies)
Discussion started by: digioleg54
2 Replies

2. Shell Programming and Scripting

SOAP Client server program

Hi, I have taken the below code from Quick Start with SOAP - Perl.com and modified to my requirement.Server program runs without error.I have kept Demo.pm under /usr/local/apache2/cgi-bin directory.When I run the client program I am not getting any output.Whether the client program should be... (1 Reply)
Discussion started by: liyakathali
1 Replies

3. Programming

Makefile for more than 1 executable program

Can anyone give me a makefile that creates 3 exe?for example, let's suppose i have the following files: blah1.c blah1.h blah2.c blah2.h blah3.c blah3.h i've searched and searched but so far i was not able to complete it. (4 Replies)
Discussion started by: bashuser2
4 Replies

4. 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

5. Programming

SFTP client program

can u help me? i need the program code in C to perform Simple File Transfer in linux.in this forum i found the server program,inw i need the client program ASAP. Thanx. (1 Reply)
Discussion started by: harshi
1 Replies

6. Programming

How to program a telnet client?

Hi, Experts: I have programmed a simple telnet client in sco unix 5.0.5, the client has passed throught the initial option negotiation, but I can't receive login prompt from the server. please help me. (8 Replies)
Discussion started by: thinker130
8 Replies

7. Programming

Server client program

hi guys, I need the code for a server client registration form.The server must ask for authentication .Then the client would send in data. This is stored in a file .The server sends back a receipt to the client as part of the payment done. plz can some 1 get me the code... (9 Replies)
Discussion started by: pip3r
9 Replies

8. Programming

Client - server program

i came acors this coding when surfin the net.this code works perfectly.but as i am new to this socket programming i need sm coments quoted on it or explanation regarding this source code. i have prb understanding the server.c i have posted it below can u guys help me !!!! cheerZ The... (4 Replies)
Discussion started by: mathu
4 Replies

9. Programming

Chat client-server program

Good day everyone, I'm doing a chat client-server program:server is to receive messages from clients through a TCP port and multicast them back to all clients through a UDP port. This is my client program. I'd not know why it just sends and receives msg from server once, then it stops. Is... (1 Reply)
Discussion started by: powermind
1 Replies

10. Programming

program to transfer a file from client machine to server

1. we have a client & server ,and TFTP is running on the server. 2.we have 3 files a.exe,b.exe,c.exe in the client machine....we need to transfer all the 3 files to the server and store it into a DIR... 3.then we need to check in the server whetehr all the three files are sucessfully... (3 Replies)
Discussion started by: nathgopi214
3 Replies
Login or Register to Ask a Question