Client-Server

Client-Server Architectures


EXPERIMENT ONE

For this experiment the files are located here:

frilled.cs.indiana.edu%pwd
/nfs/grouchy/home/user2/www/classes/a348-dger/t540/spr2002/lectures/code/Eleven
frilled.cs.indiana.edu%ls -ld . 
drwxr-xr-x   3 dgerman      1024 Apr 25 12:48 .
frilled.cs.indiana.edu%ls -ld *.html
-rw-r--r--   1 dgerman       250 Apr 25 12:06 GUIServer.html
-rw-r--r--   1 dgerman       275 Apr 25 12:44 GuessClient.html
-rw-r--r--   1 dgerman       229 Apr 25 12:18 GuessServer.html
frilled.cs.indiana.edu%ls -ld *.java
-rw-r--r--   1 dgerman      3564 Apr 25 12:12 AbstractConnection.java
-rw-r--r--   1 dgerman      2991 Apr 25 12:04 GUIServer.java
-rw-r--r--   1 dgerman      3263 Apr 25 12:48 GuessClient.java
-rw-r--r--   1 dgerman      4369 Apr 25 12:13 GuessServer.java
frilled.cs.indiana.edu%
Once you get them you need to set the experiment up this way.

1. Refer to your Socket port, we will need it.

2. Copy all your files to your Apache, for example I have them here:

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/apache/apache_1.3.22/htdocs/petchel/guess
burrowww.cs.indiana.edu% ls -ld *.html
-rw-r--r--   1 dgerman  faculty       250 Apr 25 12:55 GUIServer.html
-rw-r--r--   1 dgerman  faculty       276 Apr 25 12:58 GuessClient.html
-rw-r--r--   1 dgerman  faculty       229 Apr 25 12:55 GuessServer.html
burrowww.cs.indiana.edu% ls -ld *.java
-rw-r--r--   1 dgerman  faculty      3564 Apr 25 12:55 AbstractConnection.java
-rw-r--r--   1 dgerman  faculty      2991 Apr 25 12:55 GUIServer.java
-rw-r--r--   1 dgerman  faculty      3263 Apr 25 12:55 GuessClient.java
-rw-r--r--   1 dgerman  faculty      4369 Apr 25 12:55 GuessServer.java
burrowww.cs.indiana.edu% grep -i 38999 *.java
burrowww.cs.indiana.edu% grep -i 38999 *.html
GuessClient.html:      <param name="Port" value = 38999>
GuessServer.html:      <param name="Port" value = 38999>
burrowww.cs.indiana.edu% grep -i burrowww *.*   
GuessClient.html:      <param name="Host" value = "burrowww.cs.indiana.edu">
burrowww.cs.indiana.edu%
3. Notice you need to enter some parameters specific to your experiment.

4. Use your appletviewer to start your server on burrowww

appletviewer GuessServer.html
(Please make sure you use jdk1.4, let me know if you don't).

5. Use your appletviewer to connect from your PC to the GuessClient applet.

appletviewer http://burrowww.cs.indiana.edu:36000/petchel/guess/GuessClient.html
(Make sure you have 1.4 on your PC, the default now in LH115).

Also note that

  1. to get the applet you contact Apache,
  2. when the applet comes it starts its own networking.

    6. Play the game (notice the server tells you on the command line what number it is).

    7. Shutdown everything, look at the code.

    EXPERIMENT TWO

    This is somewhat tricky, but should work fine: connectionless networks using UDP.

    frilled.cs.indiana.edu%pwd
    /nfs/grouchy/home/user2/www/classes/a348-dger/t540/spr2002/lectures/code/Thirteen
    frilled.cs.indiana.edu%ls -ld . 
    drwxr-xr-x   3 dgerman       512 Apr 25 14:28 .
    frilled.cs.indiana.edu%ls -ld *.java
    -rw-r--r--   1 dgerman      2314 Apr 25 13:58 MulticastConnection.java
    -rw-r--r--   1 dgerman      5109 Apr 25 13:41 SimpleChatClient.java
    -rw-r--r--   1 dgerman      2827 Apr 25 13:38 SimpleChatServer.java
    frilled.cs.indiana.edu%grep -i DEFAULT_PORT *.java
    MulticastConnection.java:    public static final int DEFAULT_PORT = 38999; // 1234;
    MulticastConnection.java:	mcSocket  = (port > 0) ? new MulticastSocket(port) : new MulticastSocket(DEFAULT_PORT);
    SimpleChatClient.java:				MulticastConnection.DEFAULT_PORT + "...\n");
    SimpleChatClient.java:		client = new MulticastConnection(address, MulticastConnection.DEFAULT_PORT);
    SimpleChatServer.java:	int port       = MulticastConnection.DEFAULT_PORT;
    frilled.cs.indiana.edu%

    So, we'll try it. If this works, we will implement a networked Bingo! game.


    Last updated: Apr 24, 2002 by Adrian German for T540