• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1770
  • Last Modified:

Client Server Observer In Java

I want to see a Java example of a Client Server using the Observer design pattern. A server should send client all updates of a variable for example. I am farmilar with the Observer pattern and its Java implementation. Not so good with client server implementation, i have viewed this example so far.

http://www.developer.com/java/ent/article.php/1356891

However the ClientThread when I compile it gives me an error saying the catch should not be contained within the try block.

If you have any examples or links that would help me with this more please do let me know.
0
namsu55
Asked:
namsu55
  • 3
  • 2
1 Solution
 
objectsCommented:
there won't be many of those around, why don't you just fix the error in the one you've got? btw why using Observer, its a bit of a dinosaur.

0
 
namsu55Author Commented:
Just so I can send some updates to a few GUI's. View the code not sure why its giving me that error. I cant see what is even wrong with it looks fine.
0
 
objectsCommented:
     try {
        pw.println("Welcome to Java based Server");
      }
      catch(IOException ioe) { }

in the ClientThread just remove the try catch from the above code
so it becomes

        pw.println("Welcome to Java based Server");



0
 
namsu55Author Commented:
That works just testing this code out.
0
 
objectsCommented:
but I answered your question didn't I?

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now