Hi all,
I am trying to call Connect system function in my client application and when the box is offnet or powered down it is taking awful lot of time to return from that call. I want to wrap around this function a timer so that..it waits for that time and returns out of that. but as i am a newbie to the socket program..cant really figure out how to accomplish this. following is a simple call i am using
while(connect(sock,(struct sockaddr *)&portaddr,sizeof(portaddr))<0) {
if(NETtimedout) {
close(sock);
return(-4);
}
I want to just wait for 5 secs and close Socket. any ideas how to write a wrapper around this.
Thanks in advance
prasad
I am trying to call Connect system function in my client application and when the box is offnet or powered down it is taking awful lot of time to return from that call. I want to wrap around this function a timer so that..it waits for that time and returns out of that. but as i am a newbie to the socket program..cant really figure out how to accomplish this. following is a simple call i am using
while(connect(sock,(struct sockaddr *)&portaddr,sizeof(portaddr))<0) {
if(NETtimedout) {
close(sock);
return(-4);
}
I want to just wait for 5 secs and close Socket. any ideas how to write a wrapper around this.
Thanks in advance
prasad