Take the 2-minute tour ×  In my program, I am trying to
implement support for dual-stack operation (both IPv4 and IPv6
sockets).  In the case of IPv4, everything is working fine. But
in the IPv6 case, accept() is returning a -1 value (an error).
Can anyone suggest the possible reasons, and how to fix it?
share|improve this question add comment  1 Answer  up vote 1
down vote accepted  When accept() returns -1, errno will be set
to indicate what specific error occurred. Please call
perror("accept") for an easy way to see what the error was, and
update your question with the results.  Also, please note that
accept() must be called on a socket that has been:    • Created
using the socket() call. (you should pass PF_INET6 for the first
argument of your socket to create an IPv6 protocol family
socket)   • Bound, using bind() using a struct sockaddr_in6
parameter as the 2nd parameter (with its sin6_family set to
AF_INET6 for IPv6 to indicate you will be binding to an IPv6
address). Remember to zero out the sin6_ze