[Red5] RTMPClient for help
Atulesh MORE
atuleshrao at gmail.com
Mon Jun 2 02:09:11 PDT 2008
just create ur method in oflademo's apConnect file and call it from rtmp
java client
package org.red5.server.webapp.echo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang.RandomStringUtils;
import org.red5.io.utils.ObjectMap;
import org.red5.server.api.IConnection;
import org.red5.server.api.Red5;
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 TestClient
{
public static void main(String[] args)
{
List<String> userNames = new ArrayList<String>();
userNames.add("sri");
userNames.add("something");
for (String name : userNames)
{
try
{
Thread t = new Thread(new MyCallback("sri"));
Thread.sleep(3000);
t.start();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}//End Of main
static class MyCallback implements Runnable
{
RTMPClient client = new RTMPClient();
List<String> actions = new ArrayList<String>();
protected static final ThreadLocal<IConnection> currentSession =
new ThreadLocal<IConnection>();
static boolean created = false;
IConnection conn = null;
public MyCallback(String name)
{
init(name);
}
public void run()
{
try
{
Red5.setConnectionLocal(conn);
while (true)
{
System.out.println("conn is........"+conn);
//Now it will invoke addNumber method in appConnect.java and send it two
no 3 and 4 and got their addition
client.invoke("addNumber",new Object[]{3,4}, new IPendingServiceCallback()
{
public void
resultReceived(IPendingServiceCall call)
{
System.err.println("Result Received: " +
call.getResult());
}
});
Thread.sleep(5000);
}//end of while
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
private void init(String login)
{
ObjectMap<String, Object> params = new ObjectMap<String,
Object>();
params.put("app", "elcMagnets/");
params.put("tcUrl", "rtmp://10.0.0.6/elcMagnets/");
Map<String, Object> tparams = new HashMap<String, Object>();
tparams.put("password", "password");
tparams.put("username", login);
Object[] obj = new Object[] { tparams };
client.connect("10.0.0.6", 1935, params,
new IPendingServiceCallback()
{
public void resultReceived(IPendingServiceCall call)
{
System.err.println("Second result Received: "+ call.getResult()
+ "::" + Red5.getConnectionLocal().hashCode());
conn = Red5.getConnectionLocal();
}
});
}
}
}
Regards-- Atulesh
____________________________________________________________________________________________________________________
On Mon, Jun 2, 2008 at 1:51 AM, Yuliang-Yang <zjuyyl at gmail.com> wrote:
>
> can any one give me any adivice?
> 2008/5/29, Yuliang-Yang <zjuyyl at gmail.com>:
>>
>> javaclient:
>> private RTMPClient rtmp = new RTMPClient();
>> rtmp.connect("172.16.2.83", 443, "dfwlogin");
>>
>>
>> server
>>
>> public boolean connect(IConnection conn, IScope scope, Object[] params) {
>>
>> log.debug("connect...");
>> if (!super.connect(conn, scope, params)) {
>> return false;
>> }
>> return true;
>>
>> }
>> At a flash client I can use
>> nc.connect("this is my first param");
>> to pass the params,
>> My question is How can I pass the params from javaClient,,
>>
>> --
>> best regards,
>>
>
>
>
> --
> best regards,
> _______________________________________________
> Red5 mailing list
> Red5 at osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20080602/f855d3a9/attachment.html
More information about the Red5
mailing list