Called when an error occurs on the socket.
Start establishing a connection.
void onConnect(TcpConnection socket) { auto anchor = new ThreadAnchor; new Thread({ string s = readln(); anchor.runAsync({ socket.send(s); socket.disconnect(); }); }).start(); }
An object which allows calling a function in a different thread. Create ThreadAnchor in the main thread (the thread in which the code will run in), and then call runWait or runAsync from a different thread.
The main thread must be running an unblocked ae.net.asockets event loop.