Is there a definition of how a Socket shutdown(2) operation should behave if there is still a child process that has the socket open as well?
Although not that pretty, code like the one below has been working as intended for years (AIX3, 4, Suse7). Under Fedora Core 3 (2.6.11-1.27 kernel), however, I noticed that the client process does no longer receive requests.
Any help is appreciated,
int sok = do_listen (12345);
shutdown (sok, SHUT_RD);
sleep (120); // Try connecting with e.g. telnet localhost 12345
int do_listen (int port)
struct sockaddr_in s;
sok = socket (AF_INET, SOCK_STREAM, 0);
s.sin_family = AF_INET;
s.sin_port = htons (port);
s.sin_addr.s_addr = INADDR_ANY;
bind (sok, (struct sockaddr *)&s, sizeof(s));
listen (sok, 5);