Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can a server PUSH client?  RSS feed

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i use the swing write the client-side console,but this client side console fuction not as normal,it don't receive info ACTIVATELY, it works as a monitor to superwise other computer(i call it server),the server push data to the client-side console,that means the swing client PASSIVATELY get info,one info item arrived,the one item is displayed on a table within the client console.
who can tell me,what's the better solution to my requirement,socket or rmi?and how?
thank you very much!
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't done RMI beyond a simple Sun tutorial, but I'd contrast them this way. Sockets is a message sending paradigm. The sender has to do some work to compose the message as a stream of bytes and the receiver has to do some work to interpret the message. RMI moves you up a level of abstraction (usually a good thing) and lets you think in more object and method terms. Sockets are pretty much language and platform independent. RMI is a Java-to-Java thing.
Either way, your "client" monitor has to open a serversocket or make itself an RMI server, and the "server" machine acts as a client. This reversal of normal roles is potentially confusing, but works out quite nicely. Let us know what you decide and how you make it work!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!