×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    XMLSocket to localhost problem

    Hi, i'm porting a Flash Lite 2.1 application to FL 3.0.
    The application talks with a symbian program through socket and HTTP requests.

    Under FL 3, the application cannot establish a socket connection to localhost. The symbian http server is never requested a crossdomain.xml file, and the socket port is never opened.
    The issue arises only when connecting to localhost; socket connections to external addresses are successful.
    HTTP requests to localhost work fine as well, only the socket connection fails.

    I also tried a 2 phones scenario, where the first phone hosts the symbian server, and the second phone runs the flash application. It worked.

    It's very easy to reproduce the problem: install the Nokia web server, and try to open an XMLSocket to localhost:80.

    Can anybody confirm the issue?

  2. #2
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    Are you using the Flash Lite 3 Developer Edition player, or the Nokia N95 8GB version?
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: XMLSocket to localhost problem

    Quote Originally Posted by markadoherty View Post
    Are you using the Flash Lite 3 Developer Edition player, or the Nokia N95 8GB version?
    I'm using the Developer Edition player on a Nokia E65 and Nokia N95 first model.

  4. #4
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    Have you followed the example of my blog?

    It's in the examples section....
    http://flashmobileblog.com/?page_id=7
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: XMLSocket to localhost problem

    Quote Originally Posted by markadoherty View Post
    Have you followed the example of my blog?
    The only difference i see, is that you connect to a remote host.
    Here's the test code:
    Code:
    var HOST = "127.0.0.1";
    var PORT = 55555;
    
    var mcLoader:MovieClipLoader;
    mcLoader = new MovieClipLoader();
    
    listener = new Object();
    listener.onLoadComplete = function(mcc:MovieClip, httpStatus:Number) {
    	dtText.text += "onLoadComplete: "+mcc+" ("+httpStatus+")"+"\n";
    	socketConnect();
    };
    listener.onLoadStart = function(mcc:MovieClip) {
    	dtText.text += "onLoadStart: "+mcc+"\n";
    };
    listener.onLoadError = function(mcc:MovieClip, errorCode:String, httpStatus:Number) {
    	dtText.text += "onLoadError "+errorCode+" ("+httpStatus+")"+"\n";
    };
    mcLoader.addListener(listener);
    
    dtText.text += "Loading clip..."+"\n";
    mcLoader.loadClip("http://community.forum.nokia.com/images/forumnokia.gif",this.mcTest);
    
    socketConnect = function (message) {
    	dtText.text += "Loading security policy...."+"\n";
    	System.security.loadPolicyFile("http://"+HOST+"/crossdomain.xml");
    	dtText.text += "Connecting "+HOST+" socket...."+"\n";
    	socket.connect(HOST,PORT);
    };
    
    var socket = new XMLSocket();
    socket.onConnect = function(status:Boolean):Void  {
    	dtText.text += "onConnect: "+status+"\n";
    };
    socket.onClose = function():Void  {
    	dtText.text += "onClose: "+status+"\n";
    };
    You'll need a MovieClip called mcTest and a dynamic Text called dtText.
    It seems that socket.connect() does not wait for the user to select an access point; for this reason i load an image at start.
    This code works if i set the host to socket.sytes.net:8888 or if i access the phone socket with another phone.
    In the case the host is set to localhost or 127.0.0.1, no request for policy file is received by the local HTTP server, and the onConnect callback is given status=false.

  6. #6
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    Your problem might be caused by the player sandbox, implemented by the host application.

    To use the browser model what you are attempting is to gain networking access using a local file. It's called localwithnetworking in the player code.

    Access to this capability is controlled on the desktop with a browser pop-up which asks the user if they trust the content. If a user selects accept then the content is copied to a location on the hard drive. On devices this is implemented in the form of a trusted folder, in the case of the FL3 developer edition player for S60 it is located at C:\Data\Others\Trusted. You can add the folder if required.

    You should place your swf file in there and try again.

    On S60 devices with the FL3 player embedded the trusted folder is held in a private folder. There is no way for you to access it without Nokia's permission.
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: XMLSocket to localhost problem

    Quote Originally Posted by markadoherty View Post
    Your problem might be caused by the player sandbox, implemented by the host application.

    To use the browser model what you are attempting is to gain networking access using a local file. It's called localwithnetworking in the player code.
    The "local" file is accessed via networking, i.e. an HTTP request to localhost. How come this count as local filesystem access?

    Quote Originally Posted by markadoherty View Post
    Access to this capability is controlled on the desktop with a browser pop-up which asks the user if they trust the content. If a user selects accept then the content is copied to a location on the hard drive. On devices this is implemented in the form of a trusted folder, in the case of the FL3 developer edition player for S60 it is located at C:\Data\Others\Trusted. You can add the folder if required.

    You should place your swf file in there and try again.

    On S60 devices with the FL3 player embedded the trusted folder is held in a private folder. There is no way for you to access it without Nokia's permission.
    Yes, in the trusted folder it works.
    However, although we can start flash from the symbian app in embedded mode (thus passing the network connection), the flash application does not start in "trusted" mode. Any workaround?

    Furthermore, in a S60 device with embedded FL3 (no dev version), how can a symbian application start a trusted flash file?

  8. #8
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: XMLSocket to localhost problem

    Mark,

    On S60 devices with the FL3 player embedded the trusted folder is held in a private folder. There is no way for you to access it without Nokia's permission.
    Do you mean private foler of application or private folder of pre-installed FL3 from Nokia?

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  9. #9
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    A private folder held by Nokia in this instance.
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  10. #10
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: XMLSocket to localhost problem

    thanks Mark,

    I might need to ask Nokia for how to get access to it.

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  11. #11
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    I don't think that will be allowed, and in fact I wouldn't recommend it to Nokia. Remember that the host implementation on their devices works in the browser too.

    Therefore allowing our code to run in the trusted folder would open a security hole in the browser, not good.

    Mark
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  12. #12
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: XMLSocket to localhost problem

    So, how to go with standalone FL applications?

    Does that mean standalone FL applications are not going to be supported/encouraged by Adobe and Nokia?

    I think there should be an option, as offline mobile applications are sill very important medium because data rates on mobile are high, and users don't want to download the application for each use.

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  13. #13
    Product Specialist
    Join Date
    Jun 2003
    Location
    UK
    Posts
    191

    Re: XMLSocket to localhost problem

    It sounds like you have answered your own question. If you are building a standalone application then you only need to compile for 'local access only'.

    Saying that I do agree with you that there is an issue. Content on mobile devices are largely trusted anyway because they are signed etc.

    The problem is in ensuring that the browser is sandboxed as required. This is the choice that the team had to decide on, to have the FL3 player behave the same as Flash 8 or differently on mobile devices.

    It is likely that we can fix this quite easily soon enough. You should continue to build the application using the trusted folder for now.
    Mark Doherty
    Developer Evangelist
    Adobe Systems, Mobile and Devices EMEA

  14. #14
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Karachi, Pakistan
    Posts
    277

    Re: XMLSocket to localhost problem

    Hi Mark,

    Thanks for your reply.

    Well, local-only mode works quite well for simple offline applications. But for example a little bit complex games/applications which requires to load swfs from local storage as well as they might also require updated information from internet.

    For example, mobiExplore. A great travel guide. But the issue remains same. The application fails to work online silently, while, if it is set new FL3 security model, it needs to be re-compiled again with SWF8 version. Then, it will not be backward compatible.

    I will test out local Trusted folder further, and see how it can be used as workaround until we get some good news.

    best,

    // chall3ng3r //
    Faisal Iqbal (skype: chall3ng3r)
    Flash Mobile Specialist | Orison Technologies
    _____________________________________
    blog: F·L·A·S·H·I·S·M
    swf2go: www.swf2go.com

  15. #15
    Nokia Developer Champion
    Join Date
    Apr 2005
    Location
    Boston
    Posts
    517

    Re: XMLSocket to localhost problem

    Ciao,

    jumping into the discussion.

    What about the following scenario:

    I have a FL 3 application that needs both local and remote access
    I package it in a sis, which installs in a private folder
    I Sign the sis

    Is the FL 3 application able to connect to the internet?

    Alessandro

Similar Threads

  1. Nokia N958GB Flash Lite 3.0 XMLSocket Bug (Firmware v15.0.015)
    By ryan_at_frog in forum [Archived] Flash Lite on Nokia Devices
    Replies: 13
    Last Post: 2009-10-26, 22:08
  2. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. D211 new linux driver 1.04 not working !!
    By franz_meyer in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-12, 08:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×