wikiti / extension-networking

Library developed for OpenFL to facilitate connections between applications, using TCP sockets, and following the scheme of event-driven programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flash sockets error

wikiti opened this issue · comments

The following error is being generated on the client side while targeting flash:

Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
 at networking.wrappers::SocketWrapper()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\wrappers\SocketWrapper.hx:29]
 at networking.sessions.items::ClientObject/initializeSocket()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\sessions\items\ClientObject.hx:89]
 at networking.sessions.client::Client/threadCreate()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\sessions\client\Client.hx:95]
 at networking.wrappers::ThreadWrapper/handler()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\wrappers\ThreadWrapper.hx:64]
 at lime.app::_Event_Dynamic_Void/dispatch()[C:\HaxeToolkit\haxe\lib\lime\3,5,2\lime\system\ThreadPool.hx:25]
 at lime.system::ThreadPool/queue()
 at networking.wrappers::ThreadWrapper()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\wrappers\ThreadWrapper.hx:42]
 at networking.sessions.client::Client()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\sessions\client\Client.hx:59]
 at networking.sessions::Session/start()[C:\HaxeToolkit\haxe\lib\extension-networking\1,3,3\src\networking\sessions\Session.hx:94]
 ...

Things to try:

  • Use latest Haxe, Lime and OpenFL versions. Fixes nothing.
  • Isolate the error in a small project. Fixes nothing.

Required fixes:

  • Refactor library sockets (openfl.net.Socket) to use events instead of synchronous behaviour.
  • Add a XmlPolicyFileServer to handle flash policy files.
  • Create a wiki page about How to allow flash clients. Please, check #4.

So, just to see if I am clear on this, the problem occurs when an openfl.net.Socket; is created.

It actually sends : [ ?oy4:dataoy4:uuidy36:FBF162F8-D25E-253A-AF72-E0062D26B555y4:verby29:_core.sync.update_client_datagy8:metadataoy6:clientoy6:activetR1R2gy6:serverngg]

... before it fails. I'm trying to find out what _core.sync.update_client_data is, now.

The _core.sync.update_client_data is a special message that will be handled by this section of the code.

  • The server waits for a client.
  • A client connects to the server.
  • The server accepts the connection.
  • The client tells the server who he is (uuid) by sending a _core.sync.update_client_data message.
  • The server accepts the message.
  • The connection is fully established.

I'll try to replicate the error on a smaller pair of projects over this weekend.

We'll, after reading some documentation, it seems that openfl.net.Socket requires some events to setup. The error does not occur when targeting cpp or neko because they use haxe.net.Socket instead.

I'm already testing on some mini projects, and I'll try to rebuild the non-native side of this library on the following weeks (vacations, wohoo!).

Also, issue #3 may be related to this one.

So, current changes for this issue are on flash-setup. The following tasks has been done:

  • Create a basic policy-file server to allow flash targets.
  • Refactor code to use properly openfl.net.Socket with events.
    • Allow clients to recieve messages properly.

Things that has to be done:

  • Fix message sending issues for openfl.net.Socket.
  • Test flash target.

@f-rank I've finally fixed it. I'll publish the newest version of the library tomorrow. Meanwhile, you may want to read this wiki article to understand the required changes to make it work.

@f-rank Version 1.4.0 has been just released: https://lib.haxe.org/p/extension-networking/1.4.0/

Could you check if that new version works for you?

Best regards,
Daniel

Can confirm. Works solid.
Thank you for looking at this and fixing it, I was up to serving a .xml through neko but was clearly missing on something.

Best regards,
Frank

@f-rank I'm closing this issue as it is resolved now. If you've more questions or find related bugs, feel free to re-open this issue, or create a new one.

Best regards,
Daniel