Hi Mohsin,

I have http server working simultaneously on both IPv4 and IPv6 sockets.
Here are my suggestions in your code:
1. Why you are using same "iStatus" for both socket descriptors?
2. Same question for "sin". For IPv4, you need to use struct sockaddr_in,
whereas for IPv6 struct sockaddr_in6 variable, so two different variables.
3. iStatus = socket( AF_INET, SOCK_STREAM, 0 ); => 0 should be replaced by
IPPROTO_TCP which is 6

Thanks,
Rahul

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


On Fri, Apr 10, 2015 at 12:17 AM, Mohsin <[email protected]>
wrote:

> [email protected] wrote
> > goldsimon@
>
> >  wrote:
> >> Ivan Delamer wrote:
> >>> I don't use the socket API but as far as I can remember, all you need
> >>> is one socket listening on IPv6 ANY address.
> >> Is that so?
> >
> > After a bit of reading, I'm back in the issue: yes, it's that way and it
> > should work in lwIP, too. If not, that's a (regression) bug.
>
> Hi Simon,
>
> I tried binding a socket to IPv6 ANY address, but it just works for IPv6
> address only and not for IPv4.
>
> I even tried setting #define SO_REUSE  1 as per Philips suggestion, but
> still same problem.
>
> So, maybe there is some functionality lacking in pcb which can support
> reuse of same listening port for different protocol versions
> simultaneously.
>
>
> Regards,
> Mohsin Kesarani
>
>
>
>
>
> --
> View this message in context:
> http://lwip.100.n7.nabble.com/How-to-have-two-different-sockets-for-IPv4-and-IPv6-tp24291p24302.html
> Sent from the lwip-users mailing list archive at Nabble.com.
>
> _______________________________________________
> lwip-users mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to