#1 2024-12-02 15:48:35

zen010101
Member
Registered: 2024-06-15
Posts: 70

IPv4 and IPv6

How do I make a socket-based HTTP server listen for both 0.0.0.0 and [::] addresses? Just like http.sys.

Offline

#2 2024-12-02 19:00:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: IPv4 and IPv6

IPv6 :: binding was not currently supported.

Please try with
https://github.com/synopse/mORMot2/commit/fc6e585c

Offline

#3 Yesterday 01:41:44

zen010101
Member
Registered: 2024-06-15
Posts: 70

Re: IPv4 and IPv6

How can I make a TRestHttpServer to listen both of IPv4/6 ?

TRestHttpServer.Create(HttpPort, [SampleServer], '+', HTTP_DEFAULT_MODE, 4);

This will using http.sys and listen both 0.0.0.0 and [::].

TRestHttpServer.Create(HttpPort, [SampleServer], '+', WEBSOCKETS_DEFAULT_MODE, 4);

This will only listen 0.0.0.0

TRestHttpServer.Create('[::]:'+HttpPort, [SampleServer], '+', WEBSOCKETS_DEFAULT_MODE, 4);

This will only listen [::].

Offline

#4 Yesterday 08:34:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: IPv4 and IPv6

Dual binding is touchy: we need to bind as IPV6 then allow IPV4 mapping - but the IPV6_V6ONLY option is not available on some OS, or disabled.
https://lwn.net/Articles/688462/

http.sys makes no direct binding, all is done in the kernel mode.

Any input is welcome.

Offline

Board footer

Powered by FluxBB