Hi,

sorry for the delay I was busy and not really checking the group

by default redtamarin does not have the classic flash.net.Socket classes
(it is possible to emulate them but not done yet)

so you would want to use avmplus.Socket class
documented here
https://code.google.com/p/redtamarin/wiki/Socket


here an example implementing a socket policy server
https://code.google.com/p/spitfire-and-firedrop/source/browse/trunk/socketpolicyd/src/spitfire/SocketPolicyServer.as


in short, the Socket class impl. in redtamarin allow to do more stuff
but is a bit harder to use

the implementation is very close to the classic BSD socket in C/C++
see http://beej.us/guide/bgnet/



now for the flow, here the 2 best way imho

1) implement the missing libraries from the Flash Platform
    see avmglue
    https://code.google.com/p/maashaack/wiki/avmglue
  
  https://code.google.com/p/maashaack/source/browse/platform/avmglue/trunk/


for example
----
package flash.net
{
  public class Socket extends EventDispatcher implements IDataInput, 
IDataOutput
  {

    private var _sock:avmplus.Socket; //use the full package path

    public function Socket( host:String = null, port:int = 0 )
    {
        _sock = new avmplus.Socket();
    }

    public function connect(host:String, port:int):void
    {
        _sock.connect( host, port );
    }

  }
}
----

you would have to do your own wiring for the events
see https://code.google.com/p/redtamarin/wiki/Socket#Callbacks

for ex
----
package flash.net
{
  public class Socket extends EventDispatcher implements IDataInput, 
IDataOutput
  {

    private var _sock:avmplus.Socket; //use the full package path

    public function Socket( host:String = null, port:int = 0 )
    {
        _sock = new avmplus.Socket();
        _hookCallbacks();
    }

    private function _onConnect():void
    {
      dispatchEvent( new Event( Event.CONNECT ) );
    }

    private function _hookCallbacks():void
    {
      _sock.onConnect = _onConnect;
    }


    public function connect(host:String, port:int):void
    {
        _sock.connect( host, port );
    }

  }
}
----

or
2) use conditional compilation
see
https://code.google.com/p/maashaack/wiki/ConditionalCompilation

for example
https://code.google.com/p/maashaack/source/browse/packages/core/trunk/src/core/reflect/hasDefinitionByName.as

this allow you to keep the different implementations in the same file
and can be more desirable in some cases

cheers,
zwetan


Le lundi 11 mars 2013 20:52:37 UTC, julifos a écrit :
>
> Hi everyone!
>
> I'm new to redtamarin.
>
> I'm trying to bring AS3 code to redtamarin and I must use some libraries 
> which use sockets, http requests and so on. What would be the flow to 
> compile such a code? I already had a hard time making work the "Hellow 
> world" ;-)
>
> I'm using Flash Builder and a bunch of .as files...
>
> Thanks in advance!
>
>
> jj
>

-- 
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes FCNG.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, 
envoyez un e-mail à l'adresse fcng+unsubscr...@googlegroups.com.
Pour envoyer un message à ce groupe, adressez un e-mail à fcng@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/fcng?hl=fr .
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .


Répondre à