• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: 101 Networking and message handling

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are in network mode and your sever is running on another
computer. And you get an exception in your server code so you
send a message to the user via a JDialog/JOptionPane, will the end
user using the gui front end on another computer get the pop-up message
or is it lost on the server computer? Am I making sense? Because
I know if you print the details of an exception it will not show
up on the client side, given you handled and printed the details from the server side, but I am not sure about dialog messages. How does it
come through to the gui client?
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew could you help on this?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using RMI and you've got a class running on the server which implements the Remote interface, then when a client does Naming.lookup() or whatever and gets aremote reference to your server instance, they can call methods. If the client calls update() and the server throws a SecurityException(), the client will see a SecurityException thrown from the update() method it called on the remote proxy. Behind the scenes, RMI has serialized the exception thrown on the server and passed it to the client, making it look like it was thrown form the client. (All exceptions implement Serializable, so this is possible). If you use sockets rather than RMI, you will have to send some sort of signal through the socket to tell the client that an exception needs to be thrown. The simplest wayt to do this is probably to use an ObjectOutputStream to serialize the exception and send it through the socket, much like RMI does (except you ahve to code it yourself). Or you could devise some other communications protocol which may be faster but require even more coding on your part; it's up to you.
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim, I am using RMI. I was just wondering if a dialog message box
would appear on the client side even though the
call to the dialog was made on the the server side.
Given of course the server and client resided on two different machines.
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope. All communication between client & server will be through the methods of Remote interfaces. Data are passed as method parameters, return values, or exceptions. Any other side effects of a method call occur only on the machine that hosts the implementation of the remote object (ther server).
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks jim!!!
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic