Search code examples
apache-flexflashactionscript-3rtmfp

Is there a way to access the remote IP of a RTMFP p2p stream?


I'm writing a communication system, using Actionscript 3 and C#. Flash is used to communicate with RTMP server and stream video and audio using RTMFP p2p, but the actual client logic is handled in C#.

What I want to be able to do, is allow users to share files between each other also using a direct p2p connection.

I have got the RTMFP connection working but I need to access the IP address of the remote user so I can initiate a connection to send or receive files.

I looked at the Adobe docs but I can't see anything except how to access the farID.

Is there a way to get the IP of a RTMFP stream?


Solution

  • I think you can't get the IP address through RTMFP connection, but you could use a shared object to record client IPs as a workaround:

    application.onAppStart = function() {
        application.so = SharedObject.get('my_shared_obj');
    }    
    
    application.onConnect = function(clientObj, username, password) {
        // TODO check username and password
    
        application.so.setProperty(clientObj.farID, clientObj.ip);
    }
    
    application.onDisconnect = function(clientObj) {
        application.so.setProperty(clientObj.farID, null);
    }