java - Is it possible to ask server side to execute a method without using RMI? -


i couldn't try out since don't have java web server. idea sent number server via sockets. number sent dependent on user's response or requirement.

for example: consider tic-tac-toe game. let's imagine user lost match , want user enter yes replay or no exit.

if user enters yes , program write number (eg. 1) outputstream of socket. now, server receives number using inputstream , stores in integer variable. if finds number entered 1 , game begins again. there methods handle these numbers received.

is possible communicate server , invoke remote method in manner?

if yes, why rmi designed when can done coding (pretty easily)?

is possible communicate server

yes.

and invoke remote method

no. server invoking method locally. you're sending number telling do. no remote method invocation here.

why rmi designed when can done coding (pretty easily)?

rmi provides syntax calling remote method directly, without having worry about:

  • connections
  • method numbers
  • wire specifications request , response
  • marshalling arguments
  • unmarshalling response
  • turning responses exceptions
  • ensuring responses obey exception semantics
  • dynamic class loading
  • ...

you can reimplement yourself, , of course rmi implemented in java well, don't underestimate scope, or difficulty.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -