3 ms·
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 so
by murderfs 1y ago
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)) {
// ...
}
- bigstrat2003 1y agoI don't think anyone was talking about the difficulty of implementing IPv6 in software. I certainly wasn't. I meant the difficulty of implementing it as a network admin, which is not really hard.
- deleted 1y ago[deleted]
- p1mrx 1y agohttps://beej.us/guide/bgnet/html/ https://beej.us/guide/bgnet/html/ section 5.6