.swf receiving sockets communication from localhost

Is there a way to avoid " Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: " for socket usage on a local machine in the .swf target ? I read some but it turns out I can’t remember what worked last time I had this problem.

Am using the haxe-ws lib. Sending from a cpp target to the said localhost flash running in a debug flashplayer. Should I get a server running instead and run it in a browser, am running out of ideas but do remember was possible to do some other way.

Edit for the detailed error under “debug” compile:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file:///D|/Work/HxProjects/fcp%5Fscoreboard/bin/flash/debug/bin/fcpscoreboard.swf cannot load data from 127.0.0.1:18000.
at haxe.net.impl::SocketFlash()[C:\HaxeToolkit\haxe\lib\haxe-ws\0,1,0\src\haxe\net\impl\SocketFlash.hx:22]
at MethodInfo-513()[C:\HaxeToolkit\haxe\lib\haxe-ws\0,1,0\src\haxe\net\Socket2.hx:40]
at haxe.net.impl::WebSocketGeneric()[C:\HaxeToolkit\haxe\lib\haxe-ws\0,1,0\src\haxe\net\impl\WebSocketGeneric.hx:39]
at MethodInfo-527()[C:\HaxeToolkit\haxe\lib\haxe-ws\0,1,0\src\haxe\net\WebSocket.hx:18]
at f.c.p::Hermes$/Client()[D:\Work\HxProjects\fcp_scoreboard\src\f\c\p\Hermes.hx:22]
at f.c.p::Main()[D:\Work\HxProjects\fcp_scoreboard\src\f\c\p\Main.hx:97]
at DocumentClass()[D:\Work\HxProjects\fcp_scoreboard\bin\flash\debug\haxe\ApplicationMain.hx:279]
at Type$/createInstance()[C:\HaxeToolkit\haxe\std\flash_std\Type.hx:133]
at ApplicationMain$/start()[D:\Work\HxProjects\fcp_scoreboard\bin\flash\debug\haxe\ApplicationMain.hx:213]
at ApplicationMain$/init()[D:\Work\HxProjects\fcp_scoreboard\bin\flash\debug\haxe\ApplicationMain.hx:127]
at lime.app::Event_Void_Void/dispatch()[C:\HaxeToolkit\haxe\lib\lime\3,0,3\lime\app\Event.hx:145]
at lime.app::Preloader/start()[C:\HaxeToolkit\haxe\lib\lime\3,0,3\lime\app\Preloader.hx:242]
at openfl.display::Preloader/display_onComplete()[C:\HaxeToolkit\haxe\lib\openfl\4,0,2\openfl\display\Preloader.hx:129]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at NMEPreloader/onLoaded()[D:\Work\HxProjects\fcp_scoreboard\bin\flash\debug\haxe\NMEPreloader.hx:107]
at openfl.display::Preloader/start()[C:\HaxeToolkit\haxe\lib\openfl\4,0,2\openfl\display\Preloader.hx:93]
at lime.app::Preloader/current_onEnter()[C:\HaxeToolkit\haxe\lib\lime\3,0,3\lime\app\Preloader.hx:310]

Edit 2 for the detailed error in “release” compile:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file:///D|/Work/HxProjects/fcp%5Fscoreboard/bin/flash/release/bin/fcpscoreboard.swf cannot load data from 127.0.0.1:18000.
at haxe.net.impl::SocketFlash()
at MethodInfo-513()
at haxe.net.impl::WebSocketGeneric()
at MethodInfo-527()
at f.c.p::Hermes$/Client()
at f.c.p::Main()
at DocumentClass()
at Type$/createInstance()
at ApplicationMain$/start()
at ApplicationMain$/init()
at lime.app::Event_Void_Void/dispatch()
at lime.app::Preloader/start()
at openfl.display::Preloader/display_onComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at NMEPreloader/onLoaded()
at openfl.display::Preloader/start()
at lime.app::Preloader/current_onEnter()

Does it work if you use a different sandbox type?

I believe Haxe supports -D network-sandbox, I forget if there is another option as well

I use -Dnetwork-sandbox, downloaded a command tool from adobe that allows to set the .swf to network-sandbox and it says it has thr network rights. Nothing.
The thing is if I use echotool.exe it does send the first message and gets a reply from the echotool but from then on it gives me a sandbox violation. I have altered mms.cfg to include 127.0.0.1 and have Security.LOCAL_WITH_NETWORK and Security.allowDomain("*");
I also am serving a crossdomain.xml on the correct port but it never gets asked.
Kind of stunned I can’t get around this, remember I did this some years ago for some other application. I’m stuck on .swf because of the video support right now and mapping the keyboard to start/stop stuff is kind of too kamikaze.

As of openfl 4.1.0 with lime 3.1.0, it just works.
Looked at the change log and found nothing about it. Can’t complain. :slight_smile:

I also have a problem with this and didn’t find solution yet.
my config: openFl= 4.7.3, lime=3.7.2

I create socket connection but when I try to connect with remote IP (from localhost) I get this error:
Error #2048: Security sandbox violation on Flash target.
On html5 target everything is OK.
I try a lot of solutions but still can’t connect remote socket from my machine.
Does anyone has solution for this?

Take a look at http://lib.haxe.org/p/extension-networking/ , Daniel came up with a very clean solution to serve a required file so that flash allows communication.

Well, it looks it isn’t solution for me because I use flash only for debug (because it’s fast)-my targets are html5 and mobile and those two not supported with this library.

Flash socket communication might require the correct “sandbox type” when compiling the SWF, or a “crossdomain.xml” file on the server. It might also be difficult to do when you run Flash standalone, it may work better with openfl test flash -web inside a web page.

You might also be able to get it to work with a combination of the above and making exceptions for your local file system in the settings manager

https://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html