Skip to content

Instantly share code, notes, and snippets.

@AxGord
Created December 7, 2018 11:10
Show Gist options
  • Save AxGord/4498f4533926f217c76100af80caeb23 to your computer and use it in GitHub Desktop.
Save AxGord/4498f4533926f217c76100af80caeb23 to your computer and use it in GitHub Desktop.
import pony.net.SocketClient;
import pony.net.SocketServer;
import pony.time.MainLoop;
class NekoSockets {
private static function main():Void {
MainLoop.init();
var port = 12345;
var server = new SocketServer(port);
server.onString << s -> trace('Server: $s');
server.onString << MainLoop.stop;
var client = new SocketClient(port);
client.onConnect << () -> client.sendString('Hello world!');
MainLoop.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment