lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] How to have two different sockets for IPv4 and IPv6


From: Mohsin
Subject: [lwip-users] How to have two different sockets for IPv4 and IPv6
Date: Wed, 8 Apr 2015 06:15:08 -0700 (MST)

Hi,

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. However,
the code that I wrote for both simulateniously doesn't work. I mean I'm
creating two diff webserver tasks for IPv4 and IPv6. The socket for both
AF_INET6 and AF_INET and binding it with port=80 which is as follows:

//webserver_task_IPv4
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));

//webserver_task_IPv6
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 into
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 defined
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 both
IPv4 and IPv6 at the same time.

Any help would be highly appreciated.

Thanks & regards,
Mohsin Kesarani


 



--
View this message in context: 
http://lwip.100.n7.nabble.com/How-to-have-two-different-sockets-for-IPv4-and-IPv6-tp24291.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

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