openfl.net.Socket crashes targeting cpp

119 views
Skip to first unread message

Pipiska INCorporatius

unread,
Jun 1, 2015, 8:18:03 AM6/1/15
to haxe...@googlegroups.com
Can't figure out why openfl.net.Socket does not work for me on cpp target

A simple code


var socket:Socket =  new Socket();

socket.connect(host, port);


Connects to the server but crashes when I try to send any data from server. Same happens on neko platform, but at least it gives me a long error description:

Called from sys.net.Socket::$statics line 1
Called from ApplicationMain::main line 123
Called from ApplicationMain::create line 55
Called from lime.app.Application::exec line 162
Called from lime._backend.native.NativeApplication::exec line 104
Called from lime._backend.native.NativeApplication::handleRenderEvent line 59
Called from lime.app.Application::render line 567
Called from openfl.display.Stage::render line 919
Called from openfl.display.DisplayObjectContainer::__broadcast line 644
Called from openfl.display.DisplayObjectContainer::__broadcast line 638
Called from openfl.display.DisplayObject::__broadcast line 989
Called from openfl.events.EventDispatcher::dispatchEvent line 266
Called from openfl.net.Socket::onFrame line 202
Called from haxe.io.Bytes::blit line 84
Uncaught exception - OutsideBounds

Tried to apply event listeners

socket.addEventListener(Event.CONNECT, OnConnect);

 nothing changes. I use Haxe 3.2.0 and FlashDevelop

Jeff Ward

unread,
Jun 2, 2015, 1:38:06 AM6/2/15
to haxe...@googlegroups.com
What are your host and port variables? I'm using host:String = "localhost" and port:Int = 7934 successfully. Also host ip address, such as: "10.0.10.33"

Best,
-Jeff

Pipiska INCorporatius

unread,
Jun 2, 2015, 4:25:20 AM6/2/15
to haxe...@googlegroups.com
I have used almost same values and I tried your ones and still got same error. Are you sure you build it on c++ and you can not only connect to server but recieve at least one byte of incoming data from it without crashing?

Pipiska INCorporatius

unread,
Jun 2, 2015, 4:27:24 AM6/2/15
to haxe...@googlegroups.com
P.S. And you are using Windows, right?

Jeff Ward

unread,
Jun 2, 2015, 11:54:04 PM6/2/15
to haxe...@googlegroups.com
Windows, Linux, and OSX.

public var host:String = "localhost"; public var port:Int = 7934;
socket.connect(new sys.net.Host(host), port);
socket.output.writeByte(123);

With lots of surrounding junk, from: https://github.com/jcward/hxtelemetry/blob/master/hxtelemetry/HxTelemetry.hx

Best,
-Jeff

Jeff Ward

unread,
Jun 2, 2015, 11:55:57 PM6/2/15
to haxe...@googlegroups.com
Oh, I did recently had socket problems in a testcase using Haxe 3.1.3 (maybe related, maybe a haxelib problem), so I moved to 3.2.

Best,
-Jeff

Pipiska INCorporatius

unread,
Jun 3, 2015, 4:06:58 AM6/3/15
to haxe...@googlegroups.com

Mr. Ward.

>socket.output
>sys.net.Socket

Makes so much sense especially if you are working with openfl.net.Socket :/

Jeff Ward

unread,
Jun 3, 2015, 10:04:41 AM6/3/15
to haxe...@googlegroups.com
Ah, I used openfl.net.Socket over here (at one time, not sure it's in use anymore):


Also feel free to ask around the openfl forums.

Good luck!
Reply all
Reply to author
Forward
0 new messages