All pastes #451312 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-21 12:18 UTC
rendered paste body
// neither "Connection refused" nor "Connection established successfully" appears on stderr! how come?

        fprintf(stderr, "Trying to establish a connection...\n");
        et_neg1(write_all(sd_me, (const char *)&nego, sizeof nego));
        struct nego_pack reply;
        et_neg1(read_all(sd_me, (char *)&reply, sizeof reply));

        if (memcmp(&nego, &reply, sizeof reply)) {
                fprintf(stderr, "Connection refused...\n");
                return -1;
        } else {
                fprintf(stderr, "Connection established successfully.\n");
                return fd;
        }