As title, Unix environment, when using TCP connection to a socket, create a socket, calls the connect function attempts to establish a connection with each other, but the program hangs, the connect function here stay live lead to process, the connect function is a blocking mode, please show this is what happened, the code is as follows:
Sockfd=socket (AF_INET SOCK_STREAM, 0).
Flag=an FCNTL (sockfd, F_GETFL, 0);
Flag |=O_NONBLOCK;
An FCNTL (sockfd, F_SETFL, flag);
Ret=connect (sockfd, (struct sockaddr *) & amp; Des, sizeof (des));