Okay, then please reimplement the equivalent of the following code to work with both IPv4 and IPv6:
int fd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr = { .sin_family = AF_INET, .sin_port = htons(1234) };
addr.sin_addr.s_addr = htonl(INADDR_ANY);
bind(fd, (struct sockaddr*)&addr, sizeof(addr));
listen(fd, 128);
int client;
while (client = accept(fd, 0, 0)) {
// ...
}