You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I need some non-blocking sockets for my game. I'd love to use Hashlink for quick JIT testing but apparently sys.net.Socket.select is not implemented for this target.
Here's a snippet of code I'm using:
import sys.net.Socket;
class SocketServer {
static function main() {
var sockets : Array<sys.net.Socket> = [];
var s = new sys.net.Socket();
s.bind(new sys.net.Host("localhost"),5000);
s.listen(10); // Allow a buffer of 10 pending connections. You might want this higher for a busy server
while (true) {
var results = sys.net.Socket.select(
[] // Not interested in reading
, sockets // Writing to all clients
, [s] // Waiting for new sockets from the server
, 0 // Infinite timeout
); //
for (c in results.write)
{
c.write("exit");
}
if (results.others.length > 0)
{
// Accept a new socket from the server
var c : sys.net.Socket = s.accept();
sockets.push(c);
c.setBlocking(false);
c.setFastSend(true);
c.write("your IP is "+c.peer().host.toString()+"\n");
}
}
}
}
and here's the error it produces:
Uncaught exception: SysError(Not implemented)
Called from sys.net.$Socket.select(C:\HaxeToolkit\haxe\std/hl/_std/sys/net/Socket.hx:199)
I hope I'm wrong about this and there's some fix for my problem :) otherwise I'd love to see it implemented!
The text was updated successfully, but these errors were encountered:
Hi, I need some non-blocking sockets for my game. I'd love to use Hashlink for quick JIT testing but apparently sys.net.Socket.select is not implemented for this target.
Here's a snippet of code I'm using:
and here's the error it produces:
I hope I'm wrong about this and there's some fix for my problem :) otherwise I'd love to see it implemented!
The text was updated successfully, but these errors were encountered: