For instance,
CODE
if(hd_ = bind(AF_INET, SOCK_STREAM, IPPROTO_TCP) <= 0) {
perror("socket() failure");
exit(1);
}
What's the problem?
The problem is that,
CODE
hd_ = bind(AF_INET, SOCK_STREAM, IPPROTO_TCP)
should be encapsulated within parentheses.
Why?
When the call is made, a comparison between the return value and the 0 is made, and the boolean value (0 or 1) is then assigned to hd_, thus causing the value 0 to be stored in hd_ every time, but at the same time, skipping the error catching code.
So, instead:
CODE
if((hd_ = bind(AF_INET, SOCK_STREAM, IPPROTO_TCP)) <= 0) {
perror("socket() failure");
exit(1);
}
This will then work just as it's supposed to.
Watch yer parentheses when embedding...

