Fill This Form To Receive Instant Help
Homework answers / question archive / You are asked to implement a client-server-based Internet application
You are asked to implement a client-server-based Internet application.
The server is similar to the daytime server except that it is a "seat availability for a shuttle bus" server. Your implementation does not need to report the actual number of seats available; the number of available seats always starts at 30.
NOTE: Many bus companies (e.g., at airports) have some kind of online reservation system these days.
A client can connect to the server and make one of two different requests:
For this simplified server, there is no way to release a seat and increase the count. Note that the 3 possible messages above are of variable length.
The server should be runnable from the command line with:
unix |
- |
prompt% edm.server |
|
|
and it should print out the IP address of the machine it is running on and port number it is listening on. See my example program in getIPAddress.c. For example, something like:
EDM is running on 129.128.4.80, listening on port |
24459 |
|
|
If your Unix machine (e.g., Linux under virtual machine) is causing your server problems with respect to the IP address of the server's machine, it is OK to print:
EDM is running on local host, listening on port 24459 |
|
|
and then to have the user find the actual IP address of the server/local machine using Unix's ifconfig command.
Each time that the server starts, it considers 30 seats to be available.
The client should be runnable from the command line with either:
unix |
- |
prompt% edm.client 129.128.4.80 24459 ask |
|
|
or
unix-prompt% edm.client 129.128.4.80 24459 reserve
since, of course, the client needs to know the well-known location of the server process (i.e., both IP address and port number).
If called with the "ask" command-line argument, the client will just ask the server for the number of available seats. The client will then print out the return string from the server, exactly as sent from the server. Then, the client will exit.
If called with the "reserve" command-line argument, the client will ask the server to reserve a seat. The client will then print out the return string from the server, exactly as sent from the server. Recall that a reserve request can fail with a specific kind of return string. Then, the client will exit.
Use any reasonable format for the message between client-and-server and between server-and-client. You may use any source code, with proper acknowledgement, from Jim Frost, Paul Lu, or our textbook.
The following elements are required of your programs (i.e., client program and server program):
Already member? Sign In