socket connect returning odd
I am trying to do a simple socket connect and test whether my connection succeeds or not. My reading tells me that connect upon failure should return the value of -1. I disabled the device and I am attempting to connect to, and yet my program still says the connection was successful. So I know I've goofed at this point. Does anyone see anything wrong with my testing or have just got my socket setup wrong..... Thanks for any help-
//we will need variables to hold the client socket.
//thus we declare them here.
cout <<"opening client socket"<<endl;
// memset((char *) &from,0,sizeof(from));
//connect to printer
if ((connect (client, (struct sockaddr*)&from, sizeof from)==-1))
cout <<"client connect failed"<<endl;
else if ((connect (client, (struct sockaddr*)&from, sizeof from)!=-1))
cout <<"client connection successful"<<endl;