Skip to content

Commit

Permalink
QUIC Server Demo: Use IPv4 only
Browse files Browse the repository at this point in the history
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #24037)
  • Loading branch information
hlandau committed Apr 19, 2024
1 parent 1fe0af7 commit e4c6718
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions demos/quic/server/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ static SSL_CTX *create_ctx(const char *cert_path, const char *key_path)
static int create_socket(uint16_t port)
{
int fd = -1;
struct sockaddr_in6 sa = {0};
struct sockaddr_in sa = {0};

if ((fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
fprintf(stderr, "cannot create socket");
goto err;
}

sa.sin6_family = AF_INET6;
sa.sin6_port = htons(port);
sa.sin_family = AF_INET;
sa.sin_port = htons(port);

if (bind(fd, (const struct sockaddr *)&sa, sizeof(sa)) < 0) {
fprintf(stderr, "cannot bind to %u\n", port);
Expand Down

0 comments on commit e4c6718

Please sign in to comment.