If I want to accept a connection I call accept
, but how can I refuse a connection?
In a working socket echo client I have this if statement. In the echo server, how can I make the echo client reach this printf
statement?
...
if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) {
printf("Connecting failed\n");
return 1;
}
...