[osflash] Java client interaction with Red5 server

Amit Arora amit.arora15 at gmail.com
Thu Jun 21 06:52:45 EDT 2007


Hi

I am new in working on Red5 server.
I want to make a java client which could hit the red5 server and get the
result.
I have deployed the application on server and that is working fine.

I have tested the same application with Flash Client. Thats OK.
Now I want to simulate the same thing with JAVA client. I have found RTMP
client for that.
I have tried out that.
Below is the attached code, but not getting the resutl.

Server side code:

import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;

public class test extends ApplicationAdapter {

    public boolean appConnect(IConnection conn, Object[] params) {
         log.fatal("testClient: client connected");
          return super.appConnect(conn,params);
  }

    public Double add(Double a, Double b){
        return a + b;
    }

}


Client side code:


 import org.red5.server.api.service.IPendingServiceCall;
import org.red5.server.api.service.IPendingServiceCallback;
import org.red5.server.net.rtmp.RTMPClient;

 /**
     * A simple client simulation
     */
 public class Test  {





     public static void main(String[] args) {


         RTMPClient client = new RTMPClient();
         IPendingServiceCallback _callback = new MyCallback();
          client.connect("127.0.0.1",1935,"amit");
            Object[] params = new Object[2];
            params[0] = new Double(2);
            params[1] = new Double(3);
            client.invoke("add",_callback);
     }

     static class MyCallback implements IPendingServiceCallback {
         public void resultReceived(IPendingServiceCall call) {
             System.out.println("result
Received"+call.getServiceMethodName()+":"+call.getServiceName()+":"+call.getStatus()+":"+call.getResult());
         }
     }

 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20070621/3c675060/attachment.htm


More information about the osflash mailing list