Howto catch SocketOSException?

Jolly James via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 25 19:24:56 PDT 2017


On Sunday, 26 March 2017 at 01:22:24 UTC, bauss wrote:
> On Sunday, 26 March 2017 at 00:34:03 UTC, Jolly James wrote:
>>>[...]
>
> This part:
> catch (std.socket.SocketOSException e)
>>[...]
>
> [...]

I know that inheritance stuff, but none (!) of them catches that 
strange exception either. You can ignore the loop()-method. It is 
not called as the application will never reach this statement, 
because it cannot, because it crashes already in the 
listen()-method in consequence of the exception that does not get 
caught by the try-catch block.


>std.socket.SocketOSException at std\socket.d(975): getaddrinfo 
>error: Unknow host.
>----------------
>	0x004205BE in pure @safe bool 
>std.exception.enforce!(bool).enforce(bool, lazy object.Throwable)
>	0x0040D3A2 in @trusted std.socket.AddressInfo[] 
>std.socket.getAddressInfo!(immutable(char)[], 
>std.socket.AddressInfoFlags, std.socket.SocketType, 
>std.socket.ProtocolType).getAddressInfo(const(char[]), 
>immutable(char)[], std.socket.AddressInfoFlags, 
>std.socket.SocketType, std.socket.ProtocolType).__lambda7()
>	0x0040D37B in @safe std.socket.AddressInfo[] 
>std.socket.getAddressInfo!(immutable(char)[], 
>std.socket.AddressInfoFlags, std.socket.SocketType, 
>std.socket.ProtocolType).getAddressInfo(const(char[]), 
>immutable(char)[], std.socket.AddressInfoFlags, 
>std.socket.SocketType, std.socket.ProtocolType) at 
>C:\dlang\dmd2\windows\bin\..\..\src\phobos\std\socket.d(945)
>	0x00404DAF in ushort ae.net.asockets.TcpServer.listen(ushort, 
>immutable(char)[]) at C:\Users\jolly\src\ae\net\asockets.d(1242)
>	0x00416749 in _Dmain at C:\Users\jolly\src\app.d(48)
>	0x00423597 in 
>D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
>	0x0042355B in void rt.dmain2._d_run_main(int, char**, extern 
>(C) int function(char[][])*).runAll()
>	0x0042345C in _d_run_main
>	0x00417D74 in main at C:\Users\jolly\src\ae\net\asockets.d(7)
>	0x00443EBD in mainCRTStartup
>	0x757362C4 in BaseThreadInitThunk
>	0x773C0FD9 in RtlSubscribeWnfStateChangeNotification
>	0x773C0FA4 in RtlSubscribeWnfStateChangeNotification

↑ stacktrace


More information about the Digitalmars-d-learn mailing list