There are some sample DataExchange programs available below:
Read client
2nd version of Read client
Write client
N
<STOCK SYMBOL 1> <NUM SHARES>
<STOCK SYMBOL 2> <NUM SHARES>
...
<STOCK SYMBOL N> <NUM SHARES>
N is an integer and there are N lines following it, each bearing a stock symbol and number of shares pair. So that if the client is interested in 5 stocks then there will be 6 lines in the file. The Client should display the current value of the portfolio when it starts up and it should update the display every time the portfolio value changes.
The Server
The server component should be its own process. Clients will connect
to it through a well-known port or through some sort of directory service
(choose one). The server should then create a separate thread to handle
that particular clients request from that point onward. It is reasonable,
but not required to do some optimizations so that clients that request
the same information are handled by the same thread. This is mostly design
dependent. Once every 5 seconds, the server will pick a random number of
stocks from its inventory to change. Each stock will have a 50% chance
of changing. If a stock changes then it has a 50/50 chance of going up
or down. The amount each stock can change will vary from $0 to $10 in .25
increments. Some possible values are $1.25, $8.75, etcetera. For efficiency
purposes, stock value updates should only be sent to the client when the
value actually changes. The server will read the list of initial stocks
and stock values from a data file passed in on the command line. For instance,
you would start up the server by typing "server stocksfile". The format
of the server input file will be as follows:
N
<STOCK SYMBOL 1> <INITIAL VALUE>
<STOCK SYMBOL 2> <INITIAL VALUE>
...
<STOCK SYMBOL N> <INITIAL VALUE>
N is an integer and there are N lines following it, each bearing a stock symbol and initial stock value pair. The Stock value is a float. So that if the server maintained 30 stocks then there would be 31 lines in the file.
The Client
As before, the client component should be its own process. It should
be designed so that it can execute on any host with no change or recompililation
of the code. The client will connect to the server component through either
a well known port or through the use of some directory service (choose
whichever you like). After handshaking (if necessary), the client
should be able to send a request to the server consisting of a set of stocks
and requisite number of shares representing a portfolio. The client expects
to reply from the server telling it connection information it should use
to receive the portfolio evaluation values. Thereafter it expects to receive
an update of the estimates value of that portfolio as the stocks that comprise
that portfolio change.
The client will get the list of stocks and the number of shares that are owned from a data file. The name of this file is passed in as the first argument on the command line. If you pass the connection info of the server to the client through a command line argument then it should come after the name of the data file. For instance, you would execute a client with the line "client stocks.1" and another instance of the client with "client stocks.2".
Each client is considered a unique entity even if requests the same exact stocks as another client. The Format of the stocks file is as follows:
N
<STOCK SYMBOL 1> <NUM SHARES>
<STOCK SYMBOL 2> <NUM SHARES>
...
<STOCK SYMBOL N> <NUM SHARES>
N is an integer and there are N lines following it, each bearing a stock symbol and number of shares pair. So that if the client is interested in 5 stocks then there will be 6 lines in the file. The client should display the current value of the portfolio when it starts up and it should update the display every time the portfolio value changes.
The Server:
The server component should be its own process. Clients will connect
to it through a well-known port or through some sort of directory service
(choose one). The server should then create a separate process which will
act as a proxy for the client and calculate the value of the portfolio
on its behalf and then forward that information to the client. For this
phase, it is required to optimize the proxies so that they do not repeat
so that if two clients request the same stocks then you reuse the existing
proxy (i.e clients that request the same information are handled by the
proxy).
Use the method described in Phase One to determine when stocks change, which stocks change, and how the server determines which stocks it has. If a client requests a stock that does not exist, simply return a value of 0.0 as its share value. Also, use the aforementioned data format to determine what stocks the server will manage. Additionaly, the server will also read a list of hosts that are available to run proxy components from another data file. For instance, you would start up the server by typing "server stocksfile hostsfile". The format of the host file is as follows:
N
<HOSTNAME 1>
<HOSTNAME 2>
...
<HOSTNAME N>
N is an integer and there are N lines following it, each bearing the name of a host that can execute a proxy. So that if there were 4 such hosts then there would be 5 lines in the file. You are allowed to duplicate hosts in the file.
The proxy:
The proxy that is created by the server will use the stock values and
shares owned initially sent to the server to calculate a running value
of the portfolio as it changes. Proxies can be started up in several ways
including a combination of exec() and the unix rsh command. Be careful
with the use of abosolute path names when doing this as the code has to
run in a different directoy when I'm testing it then the one you in which
you are developing it.
Which systems to use:
In order to keep some consistency in what all of us are doing, we should
all develop this program on a SUN Sparc Solaris system. There are several
Solaris machines generally available, notably elvis.cc.gatech.edu and asperta.cc.gatech.edu.
You can log into any system on the CoC network, and then telnet to elvis
by entering "telnet elvis" (from a unix system), or using the telnet window
on WindowsNT and opening a connection to "elvis". Elvis has 4 CPU's and
lots of memory, so it should not be a bottleneck for us getting our work
done.
10% Compiles cleanly
10% Used a multi-threaded server for Phase 1
10% Used proxies properly in Phase 2
10% Phase One: One client with server test file 1
& 2
10% Phase One: Three clients with server test file
1 & 2
10% Phase Two: One client with server test file 1
& 2
10% Phase Two: Three clients with server test file
1 & 2
15% Phase Two: Three duplicate clients with server
test file 1
15% Phase Two: Three duplicate clients with server
test file 2
Instructions for creating a shar file are as follows:
1) Login to a unix machine. I am using "elvis.cc.gatech.edu" as the example here.
2)Type "shar files > sharfilename" where files is the list of the files that you are going to submit and sharfilename is the name of the shar file you re going to create. Make sure to mention how to compile your with files in your README file. If possible, include a Makefile to compile both your phase 1 and phase 2 clients, servers, and proxies.
Make sure that you do NOT include any binaries in your shar files. I am going to compile your programs from scratch. If you have any special commands needed to compile your code then mention them in your README file.
You can email a shar file to the cs6210 account by doing:
mail -s "Project 3 Submission" cs6210@cc.gatech.edu < project3.shar
Assignments will not be accepted late without prior arrangements with
the TA.