The usual note:
Also if you want to use Java for this assignment, please send an e-mail
to TA,
Mark, or
Dr. Subhlok, so we can count
how many students will use Java and arrange demo if necessary.
Basically, you do exactly the same thing as other students.
You can also use RCS/Makefile for your Java programs (using javac).
And there is no need to implement a graphical interface.
In your README file, you should also specify which version of Java you
use and on which platform or machine (Windows, bayou, pegasus, Linux).
Linux machines in 547 PGH have Blackdown Java-Linux: Java 2 - JDK 1.3
installed (under /usr/local/j2sdk1.3.0; change your path accordingly).
TA will use equipments (on Linux, SunOS, and bayou) available in the
department to test your Java programs. If you need to run on Windows
JDK, you either test it on Linux/SunOS/bayou machine or bring your
notebook/PC (or find one which works) to demo it.
Message format Each message has 15 bytes which is consisted of 4 fields. For the sake
of convenience, all data are stored as characters, and you can use
a 16-charater array to store a message (16th byte would be an end-of-string,
"\0"). So you can use string functions (strcat, strncat, strcpy,
strncpy, etc.) to construct messages or extract individual field. Messages exchanged between client and server The following state diagram describes messages exchanged between a client
and a server. Here is a list of actions with detail explanations.
For exapmle:
Last modified: February 12, 2001. Latest Hint:
Policy for late assignment (Assignment #2 only):
If you need to access Linux machines in 547 PGH from home (or anywhere
outside 547 PGH), you can use SSH client to connect to it.
For example, "ssh your_userid@redhat20.cs.uh.edu" will connect to
redhat20 in the lab. You can run ssh from bayou, pegasus, or any SunOS
machines in CS dept. Get
PuTTY (and pscp) for your Windows system.
Or visit www.openssh.com for
clients for other platforms (look for "Alternatives" at left-hand side
menu).
Submit instruction has been posted.
Also, the link to
www.simtel.net
(to get Windows/DOS version of RCS) is fixed.
Couple things we mentioned in the class.
Also, here is a copy of simple Makefile.
There is a mistake in the state diagram that a student pointed it
out to me. If there is a checksum error in WTHD/DPST/QURY, the
sever program should be able to accept a BBYE (besides
WTHD/DPST/QURY). You don't have to correct this unless you want to.
If you want to use Java on Solaris machine in 563 PGH, you can find
instruction in Dr. Steven Huang's
COSC 6390 web page.
There is a mistake in the checksum function. It should add
48 to generate a printable numerical character, '0' ~ '9'.
Overview:
You will write two C/C++ programs using BSD sockets (using AF_INET
and SOCK_STREAM) to implement
a simplified banking system which follows a homemade protocol to exchange messages
and perform withdraw, deposit, and query for customer's account. There will
be only one client and one server for this assignment.
The Protocol
Checksum = (char) ( ( (int) UID[0] + (int) Action[0] + (int) Data[0]
) mod 10 + 48);
requested withdraw/deposit/query is DONE (amount
reflects new status of account)
reply the end of connection request
indicate an ERroR (incorrect UID, unknown / unexpected action,
or checksum error)
Requirements:
server -p port_no -f account.txt
client -h servername -p port_no -d
or server port_no account.txt
client servername port_no y
# account_no amount
1112223 5000
1112244 250
223451 3010000
You can assume there will be (<=) 5 accounts. And you can decide
your own format (number of digits) of account number, as long as you can
match the account number. You can assume at any given time, amount of money
in any account will be less than 9,999,999. You have to keep track of all
account and update the file accordingly, so account information file reflects
latest status (at the end of each connection). By the way, you don't have
to implement the comment ("#") part.
Regular or debugging mode should be activated by command line parameter,
like "client -d -h servername
-p port_no" or "client
servername port_no y" to activate the debugging mode.
Discussion Questions (20 points):
Answer these questions and include them in your README file.
Submit your assignment:
At command line on CS SunOS machines (pegasus, chicken, etc.),
type
~xsun/submit assignment# filename#
then, follow the instruction.
~xsun/submit 2 server.c client.c readme.txt
Reference:
tihuang at cs . uh . edu