public Object call(int objectid,int methodid,Object[] args) throws RemoteException {
  boolean result;
  Object rvalue;
  String errmsg;
  try {
    Socket sock=new Socket(servername,port);
    OutputStream out=new BufferedOutputStream(sock.getOutputStream());
    out.write(rmiCommand);
    out.write(endofline);
    out.write(endofline);
    ObjectOutputStream dout=new ObjectOutputStream(out);
    dout.writeInt(objectid);
    dout.writeInt(methodid);
    writeParameters(dout,args);
    dout.flush();
    InputStream ins=new BufferedInputStream(sock.getInputStream());
    skipHeader(ins);
    ObjectInputStream din=new ObjectInputStream(ins);
    result=din.readBoolean();
    rvalue=null;
    errmsg=null;
    if (result)     rvalue=din.readObject();
 else     errmsg=din.readUTF();
    din.close();
    dout.close();
    sock.close();
    if (rvalue instanceof RemoteRef) {
      RemoteRef ref=(RemoteRef)rvalue;
      rvalue=createProxy(ref.oid,ref.classname);
    }
  }
 catch (  ClassNotFoundException e) {
    throw new RemoteException(e);
  }
catch (  IOException e) {
    throw new RemoteException(e);
  }
catch (  Exception e) {
    throw new RemoteException(e);
  }
  if (result)   return rvalue;
 else   throw new RemoteException(errmsg);
}

public Object call ( int objectid , int methodid , Object [ ] args ) throws RemoteException { boolean result ; Object rvalue ; String errmsg ; try { Socket sock = new Socket ( servername , port ) ; OutputStream out = new BufferedOutputStream ( sock . getOutputStream ( ) ) ; out . write ( rmiCommand ) ; out . write ( endofline ) ; out . write ( endofline ) ; ObjectOutputStream dout = new ObjectOutputStream ( out ) ; dout . writeInt ( objectid ) ; dout . writeInt ( methodid ) ; writeParameters ( dout , args ) ; dout . flush ( ) ; InputStream ins = new BufferedInputStream ( sock . getInputStream ( ) ) ; skipHeader ( ins ) ; ObjectInputStream din = new ObjectInputStream ( ins ) ; result = din . readBoolean ( ) ; rvalue = null ; errmsg = null ; if ( result ) rvalue = din . readObject ( ) ; else errmsg = din . readUTF ( ) ; din . close ( ) ; dout . close ( ) ; sock . close ( ) ; if ( rvalue instanceof RemoteRef ) { RemoteRef ref = ( RemoteRef ) rvalue ; rvalue = createProxy ( ref . oid , ref . classname ) ; } } catch ( ClassNotFoundException e ) { throw new RemoteException ( e ) ; } catch ( IOException e ) { throw new RemoteException ( e ) ; } catch ( Exception e ) { throw new RemoteException ( e ) ; } if ( result ) return rvalue ; else throw new RemoteException ( errmsg ) ; }
calls a method on a remote object . it sends a post request to the server ( via an http proxy server if needed ) . < p > this method is called by only proxy objects .
