6 #include<netinet/in_systm.h>
17 /*----------------------- CONNECT --------------------*/
18 //int select_connect(int * sk, struct sockaddr_in * my_addr, int len, int timeout)
19 int select_connect(int * sk, struct sockaddr_in * my_addr, int timeout)
27 fcntl(* sk, F_SETFL, O_NONBLOCK);
29 if((connect(*sk, (struct sockaddr *) my_addr, sizeof(* my_addr))) < 0){
31 //if((ret = connect(* sk, (struct sockaddr *) my_addr, len)) < 0){
32 // fprintf(stderr,"socket_connect(): Not connection\n");
33 fcntl(* sk, F_SETFL, 0);
38 fcntl(* sk, F_SETFL, 0);
42 if(errno == EINPROGRESS){
48 retval = select(* sk + 1, NULL, &rfds, NULL, &tv);
51 fcntl(* sk, F_SETFL, 0);
55 fcntl(* sk, F_SETFL, 0);
59 fcntl(* sk, F_SETFL, 0);
66 fcntl(* sk, F_SETFL, 0);