How do you catch an std.socket.SocketOSException?

The following does not work, as the exception occurs anyway and leads to a crash:

import ae.net.asockets;

void main(string[] args)
{
        TcpServer tcp = new TcpServer();

        try
        {
                tcp.listen(2345, "127.0.0.1c");
                // '...c' makes the IP address invalid
        }
        catch (std.socket.SocketOSException e)
        {
                return;
        }
        catch (Exception e)
        {
                return;
        }

        socketManager.loop();
}

Output:
std.socket.SocketOSException@std\socket.d(975): getaddrinfo error: Unknown Host

Reply via email to