Does UDPSocket Work?

I’m looking at using UDPSocket in my game, I feel like I’m close to getting it to work, however its simply saying “Not available on this platform” for CPP, and Custom([email protected]_recv_from) using neko. Anyone have any idea? Its hard to believe it would be thrown into the Haxe API non-working.

Heres my non-working code, server:

package;

import sys.net.UdpSocket;
import sys.net.Host;
import haxe.io.Bytes;
import haxe.io.Bytes.ofString;
import sys.net.Address;


class NetworkServer{
  public static var value:String = "Hello";
  public static var udpsocket:UdpSocket;

  public function new(){
    udpsocket = new UdpSocket();
    var localhost:Host = new Host(Host.localhost());
    //udpsocket.bind(localhost,4000);
  }

  public function getValue():String{
    var receiveBytes:Bytes = ofString("");
    var receiveAddress:Address = new Address();
    var funk = udpsocket.readFrom(receiveBytes,0,8,receiveAddress);
    return value;
  }

}

Client:

package;

import sys.net.UdpSocket;
import sys.net.Host;
import haxe.io.Bytes;
import haxe.io.Bytes.ofString;
import sys.net.Address;


class NetworkClient{
  public static var value:String = "SlamDunk";
  public static var udpsocket:UdpSocket;


  public function new(){
    udpsocket = new UdpSocket();
    var localhost:Host = new Host(Host.localhost());
    var bytes:Bytes = ofString(value);
    var address:Address = new Address();
    address.host = 2130706433;
    address.port = 4000;
    var sendPack:Int = udpsocket.sendTo(bytes,0,8,address);
  }


}

You’ll have to update to 3.3.0-rc1, since it wasn’t available in 3.2.1. Or if rc1 gives you issues, clone the latest from Github.

I installed 3.3.0, though openfl just gives segmentation fault now for C++ and Neko. I think openfl doesnt work with the newer version of haxe.

Heres what it says when I compile for flash:

Called from ? line 1
Called from CommandLineTools.hx line 1426
Called from CommandLineTools.hx line 25
Called from a C function
Called from CommandLineTools.hx line 126
Called from CommandLineTools.hx line 635
Called from lime/project/PlatformTarget.hx line 88
Called from lime/tools/platforms/FlashPlatform.hx line 240
Called from lime/tools/helpers/FlashHelper.hx line 887
Called from lime/tools/helpers/FlashHelper.hx line 707
Called from format/swf/Writer.hx line 57
Called from format/swf/Writer.hx line 103
Called from /usr/lib/haxe/std/haxe/io/Output.hx line 178
Uncaught exception - Overflow