Actionscript is just the same.
When 3rd client try to connect he will receive
"NetConnection.Connect.Rejected" as your returnObj.code in
myConnection_nc.onStatus handler, otherwise he will connect.
Try it.
2007/2/24, Jean-Philippe DELAVALLADE <[EMAIL PROTECTED]>:
> thanks but in flash ?
> Le 24 févr. 07 à 16:53, Manuel R.G. a écrit :
>
> > You could do something like that:
> >
> > public boolean appConnect (IConnection conn, Object[] params) {
> > // If there are already two clients
> > if ( getClients().size() > 1 ) {
> > // reject new client
> > rejectClient();
> > return false;
> > }
> > // accept new client
> > return true;
> > }
> >
> > 2007/2/24, Jean-Philippe DELAVALLADE <[EMAIL PROTECTED]>:
> >> hi,
> >> can you is more explicit please ?
> >> Le 24 févr. 07 à 12:30, Manuel R.G. a écrit :
> >>
> >>> You can get the already connected clients with getClients().size()
> >>> The client trying to connect isn't included yet in that IClient Set.
> >>> To reject a client: rejectClient();
> >>>
> >>>
> >>> 2007/2/24, Jean-Philippe DELAVALLADE <[EMAIL PROTECTED]>:
> >>>> Hello,
> >>>>
> >>>> To limit access for 2 users in Flash Com Server , i used this
> >>>> client
> >>>> code :
> >>>>
> >>>> myConnection_nc = new NetConnection();
> >>>> myConnection_nc.onStatus = function(returnObj) {
> >>>> if (returnObj.code == "NetConnection.Connect.Success") {
> >>>> trace("CONNECTÉ !");
> >>>> messages.text = "CONNECTÉ !";
> >>>>
> >>>> } else if (returnObj.code ==
> >>>> "NetConnection.Connect.Rejected") {
> >>>> trace("REJETÉ !");
> >>>> messages.text = "REJETÉ !";
> >>>> nc.onStatus = null;
> >>>> } else if (returnObj.code ==
> >>>> "NetConnection.Connect.Closed") {
> >>>> trace("FERMÉ !");
> >>>> messages.text = "FERMÉ ! PAS PLUS DE DEUX USERS !";
> >>>> }
> >>>> };
> >>>> appLogin = function () {
> >>>> myConnection_nc.connect("rtmp://localhost/
> >>>> test",login_txt.text);
> >>>> myResponse = new Object();
> >>>> myResponse.onResult = function(result) {
> >>>> numberOfUsers_txt.text = result;
> >>>> trace(result);
> >>>> };
> >>>> myConnection_nc.call("getUserCount");
> >>>> };
> >>>>
> >>>> and server side this one :
> >>>> application.onDisconnect = function(client) {
> >>>> trace("Client disconnecting");
> >>>> };
> >>>> application.onConnect = function(client) {
> >>>> if (application.clients.length>=2) {
> >>>> application.rejectConnection(client);
> >>>> } else {
> >>>> application.acceptConnection(client);
> >>>> trace(application.clients.length)
> >>>> }
> >>>> };
> >>>>
> >>>> How i can do and write the same thing on RED5 ??????
> >>>>
> >>>> Thanks
> >>>>
> >>>> JP
> >>>>
> >>>> _______________________________________________
> >>>> Red5 mailing list
> >>>> [email protected]
> >>>> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>>>
> >>>
> >>> _______________________________________________
> >>> Red5 mailing list
> >>> [email protected]
> >>> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>>
> >>
> >>
> >>
> >> _______________________________________________
> >> Red5 mailing list
> >> [email protected]
> >> http://osflash.org/mailman/listinfo/red5_osflash.org
> >>
> >
> > _______________________________________________
> > Red5 mailing list
> > [email protected]
> > http://osflash.org/mailman/listinfo/red5_osflash.org
> >
>
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org