Server and socket

Hi, Im writing neko server and want to communicate from openfl application with it. in i found two classes: and and what are the differences ? any cons & pros. Don’t know with one I should use and why

Haxe includes a Socket class, but only on “sys” platforms. It won’t work on HTML5, or Flash, etc.

The OpenFL Socket class is a wrapper that should work with a on native, but also work on HTML5, and is compatible with the Flash socket class. If you find any issues using it, please let us know so we can continue to improve the implementation :slight_smile:

thx, It’s sound awesome, but I have little problem.
I’ve created neko threadServer and can connect and send data to this server easly.
but when I try to recive data on openfl client (using ) like this:

s.addEventListener(ProgressEvent.SOCKET_DATA, function(e:ProgressEvent)
	     // trace(s.readUTFBytes(s.bytesAvailable));

and Im sending it like this:


i’ve got instant crash with error:

Main.hx:29: conected
Called from warlordsclash.core.Hex::$statics line 1
Called from ApplicationMain::main line 123
Called from ApplicationMain::create line 55
Called from line 163
Called from lime._backend.native.NativeApplication::exec line 108
Called from a C function
Called from lime._backend.native.NativeApplication::handleRenderEvent line 58
Called from line 568
Called from openfl.display.Stage::render line 956
Called from openfl.display.DisplayObjectContainer::__broadcast line 645
Called from openfl.display.DisplayObjectContainer::__broadcast line 639
Called from a C function
Called from openfl.display.DisplayObject::__broadcast line 1000
Called from a C function
Called from line 302
Called from line 202
Called from line 84
Uncaught exception - OutsideBounds

Are you using latest openfl and lime? A similar issue has been fixed recently.

1 Like

thx, now it’s working :slight_smile:

1 Like