unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* (web server) serving on both ipv6 and ipv4?
@ 2022-01-19  7:57 Dr. Arne Babenhauserheide
  2022-01-19  8:51 ` Maxime Devos
  2022-01-19 13:07 ` Chris Vine
  0 siblings, 2 replies; 10+ messages in thread
From: Dr. Arne Babenhauserheide @ 2022-01-19  7:57 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

Hi,


with both fibers server and (web server) there is a split between IPv4
and IPv6:


IPv4:

    (fibers:run-server handler-with-path #:family AF_INET #:port port #:addr INADDR_ANY)

    (run-server handler-with-path 'http `(#:host "localhost" #:family ,AF_INET #:addr ,INADDR_ANY #:port ,port))


IPv6:

    (define s
        (let ((s (socket AF_INET6 SOCK_STREAM 0)))
            (setsockopt s SOL_SOCKET SO_REUSEADDR 1)
            (bind s AF_INET6 (inet-pton AF_INET6 ip) port)
            s))
    (fibers:run-server handler-with-path #:family AF_INET6 #:port port #:addr (inet-pton AF_INET6 ip) #:socket s)

    (define s
        (let ((s (socket AF_INET6 SOCK_STREAM 0)))
            (setsockopt s SOL_SOCKET SO_REUSEADDR 1)
            (bind s AF_INET6 (inet-pton AF_INET6 ip) port)
            s))
    (run-server handler-with-path 'http `(#:family ,AF_INET6 #:addr (inet-pton AF_INET6 ip) #:port ,port #:socket ,s))


Is there a way to bind to both IPv6 and IPv4, so my server will react to
requests regardless of whether a client reaches my computer over IPv4 or
IPv6?


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-20 13:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  7:57 (web server) serving on both ipv6 and ipv4? Dr. Arne Babenhauserheide
2022-01-19  8:51 ` Maxime Devos
2022-01-19 18:27   ` Greg Troxel
2022-01-20  7:24     ` Dr. Arne Babenhauserheide
2022-01-20 13:38       ` Greg Troxel
2022-01-19 13:07 ` Chris Vine
2022-01-19 13:44   ` Chris Vine
2022-01-19 13:53     ` Chris Vine
2022-01-19 21:12     ` Chris Vine
2022-01-19 21:42       ` Dr. Arne Babenhauserheide

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).