lkml.org 
[lkml]   [1997]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectselect bug ?
Hi! Im trying to use non blocket connection on a line
with diald. (Very slow responce) The non blocked connect works
very well on my lan, but on the slow speed line, it hang.

the code:

sifo->sk_c = socket(AF_INET,SOCK_STREAM,0);
printf("Got socket nr:%d\n",sifo->sk_c);
if (sifo->sk_c == -1)
{
printf("Could not create socket.\n");
return;
}
res = fcntl(sifo->sk_c,F_SETFL,O_NONBLOCK);
if (res < 0)
{
printf("Could not change the socket to nonblock");
}

printf("Sending a connect req\n");
res = connect(sifo->sk_c,(struct
sockaddr*)&sifo->srv,sizeof(struct sockaddr_in));
printf("Req respond with %d %d\n",res,errno);
if (res == -1)
{
if ((errno != EWOULDBLOCK) && (errno != EINPROGRESS))
{
printf("Connect faild %d\n",errno);
close(sifo->sk_c);
return -1;
}
}
FD_ZERO(&readmask);
FD_SET(sifo->sk_c,&readmask);
tmo.tv_sec = 100;
tmo.tv_usec = 0;
printf("Enter select\n");

res = select(
sifo->sk_c+1,(fd_set*)&readmask,(fd_set*)NULL,(fd_set*)NULL,&tmo);
printf("Select returns %d timeout:%d,%d
\n",res,tmo.tv_sec,tmo.tv_usec);
if (res == -1 )
{
printf("Connect select error!\n");
close(sifo->sk_c);
return -1;
}
if (res == 0)
{
printf("Timeout in connect thread...\n");
close(sifo->sk_c);
continue;
}

The connect returns err with code 115. WINPROGRESS, thats fine.
But the select whont exit when there is a slow line.
I sniff on the ppp device, and see the SYN-flags. But nothing
happends. Any ideas ?

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.030 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site