email me at borlaj@portlandschools.org
notes previous (09/07/06) submit the dump links  
 

Networking

 

 

Use the starter code here.

 

Notes:

  • This is not a JApplet (cant do networking in an applet) but a similar class to JFrame called WatcherFrame so we extend that.
  • I didnt implement runnable, but you could
  • one new method receiveUpdate
    • Receive update will get called when you have received an update [note it receives an object, even if it might be a Dog, or whatever-> so you will need to cast it; ie (Dog d = (Dog)b;]
  • to send an update
    • connection.sendObject(whatever); //where whatever is the object you want to send
    • whatever the object is the you send, it must implement Serializable, ie:

      • public class Dog implements Serializable
  • There are several ways to start this:
    • startServerAndClient
    • justApp -just the app as a standalone
    • startServer
    • startClient

DISREGARD *****************************In a bluej project, you will need to import the library for networking here. (save it, then go to bluej, preferences, library, import it.).