Uploading your server code to your virtual machine

advertisement
UPLOADING YOUR SERVER CODE
TO YOUR VIRTUAL MACHINE
WHAT IS A VIRTUAL MACHINE?
 A virtual machine (VM) is an emulation of a particular computer system. If you remember from our Lab 6, we
developed our Rawfongo client and were able to play the game when we connected to a particular IP address.
 How was this possible? That particular IP address to which you were connecting to was the address of a virtual
machine that had the Rawfongo server running. Your client made a connection with the VM and that is how you
were able to play the game.
CREATING A FOLDER
 Go to your “Home” and create a new folder titled “test”.
 This will be the folder where you will “drag and drop” all files(.java) that belong to your server.
RUNNING PUTTY ***MAY NOT BE NEEDED***
 PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms. Simply put, it is a terminal
emulator.
 Perform a search from your computer for “putty” and open the program.
 On the screen, you will be prompted to enter a “Host Name”. You will enter “icom4015.ece.uprm.edu”. The port
will remain “22”.
 Once PuTTY is running, you will be asked to enter your login info.Your “username” will be your lab ID (for
example, 4015a28) and the password will be the same one as when you login to the lab computer.
ACCESSING AND COMPILING YOUR SERVER CODE
 Open your Eclipse, and made changes to your server and client class.
 From your terminal, write the command “cd test”.

This should update the directory path to the folder we created earlier.
As we will be working on same server
today, so each of us have to use different
port number for hosting server; i.e. you
have to select any one port from 7001 to
7999 , made respective changes in your
Game Server & Client class.
 Now, write the command “cd src”.
 Finally, write the command “javac GameServer” to compile the GameServer class.

Repeat this command for your ServerThread class.
 Finally, write the command “su – youUserName@icom4015.ece.uprm.edu” and press Enter then it will ask for
you password.
NOTE: Remember the host name would be icom4015.ece.uprm.edu & we will be hosting our
individual gameserver on different ports of this machine
RUNNING YOUR SERVER
 To run your server, go to your terminal and access your test folder once again using “cd test”.
 Now, write “java GameServer”. This should have your server start listening.
 Make sure you enter ***insert correct IP address/Host name*** in your GameClient’s socket initialization.
(icom4015.ece.uprm.edu)
 When you run your client, you should be able to play your Rawfongo game.
Download