The fourth getsockopt parameters of iOpt_Val did not change, always as initial v

val = fcntl(sockfd, F_GETFL, NULL);
val |= O_NONBLOCK;
fcntl(sockfd, F_SETFL, val);

/* connect to ca */
is_Err_Connect = connect(sockfd, (struct sockaddr*)&addr_server, sizeof(addr_server));
if(is_Err_Connect <0)
{
if(EINPROGRESS != errno)
{
close(sockfd);
return -1;
}

time_Connect.tv_set = 3;
time_Connect.tv_uset = 0;
FD_ZERO(&Sock_Fds);
FD_SET(sockfd, &Sock_Fds);
maxfd = sockfd + 1;
iRet_Select = select(maxfd, NULL, &Sock_Fds, NULL, &time_Connect);
if(iRet_Select > 0)
{
iget_Sockopt = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &iOpt_Val, &sock_len);
if(ERROR_SUCCESS != iget_Sockopt)
{
close(sockfd);
return -1;
}
if(ERROR_SUCCESS != iOpt_Val)
{
close(sockfd);
return -1;
}
}
else
{
close(sockfd);
return -1;
}
}
else
{
close(sockfd);
return -1;
}


Have a problem,
getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &iOpt_Val, &sock_len);
The fourth parameter iOpt_Val doesn't change, always as initial value. Why ah... Depressed

Started by Joy at November 15, 2016 - 10:11 PM

The problem has been solved~

Posted by Joy at November 20, 2016 - 10:39 PM