Date: Wed, 8 Apr 2015 06:15:08 -0700 (MST)
From: Mohsin <address@hidden>
Subject: [lwip-users] How to have two different sockets for IPv4 and
Content-Type: text/plain; charset=us-ascii
I am trying to write a web server that listens on both IPv4 and IPv6
addresses. Although, only one implementation at a time works fine.
the code that I wrote for both simulateniously doesn't work. I mean
creating two diff webserver tasks for IPv4 and IPv6. The socket for
AF_INET6 and AF_INET and binding it with port=80 which is as follows:
iStatus = socket( AF_INET, SOCK_STREAM, 0 );
sin.sin_family = AF_INET;
sin.sin_len = sizeof(sin);
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = HTTP_PORT_NUMBER; //port = 80
memset(&(sin.sin_zero), '\0', sizeof(sin.sin_zero));
iStatus = socket( AF_INET6, SOCK_STREAM, 0 );
sin.sin6_family = AF_INET6;
sin.sin6_len = sizeof(sin);
memset(&(sin.sin6_addr), 0, sizeof(sin.sin6_addr));
sin.sin6_port = HTTP_PORT_NUMBER; //port = 80
Actually I'm looking for "in6addr_any" for filling IPv6 ANY Address
IPv6 socket case but can't find anywhere in the stack and hence used
memset() to set sin6_addr to 0. So is there any replacement variable
for it in the stack?
Both above tasks works fine when implemented one at a time.
Can anyone please suggest proper socket binding that can listen for
IPv4 and IPv6 at the same time.
Any help would be highly appreciated.
Thanks & regards,