guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(web server) serving on both ipv6 and ipv4?


From: Dr. Arne Babenhauserheide
Subject: (web server) serving on both ipv6 and ipv4?
Date: Wed, 19 Jan 2022 08:57:51 +0100
User-agent: mu4e 1.6.10; emacs 27.2

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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]