maurice gibbs(deleted)
|
Is it possible for io-pkt to release (purge) open socket file descriptors?
|
maurice gibbs(deleted)
08/19/2009 1:49 PM
post36309
|
Is it possible for io-pkt to release (purge) open socket file descriptors?
Hi I'm chasing an odd problem.
Here's a snippet of code:
tempFD = socket( PacketFamily, SOCK_STREAM, 0 );
setsockopt( tempFD, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
sizeof(int));
bindReturn = bind( tempFD, (struct sockaddr *) &sock,
sizeof(sock));
if ( listen( tempFD, backlog) == 0)
{
while( ! tc_is_shutdown() )
{
FD_ZERO( &readSet );
FD_SET( tempFD, &readSet );
timeout.tv_sec = 1;
timeout.tv_usec = 0;
result = select( tempFD + 1, &readSet, 0, 0, &timeout );
if (result == -1)
{
break;
}
else if (result == 0)
{
if ( tc_is_shutdown() )
break;
else
continue;
}
if ( ! FD_ISSET( tempFD, &readSet ) )
continue;
ses_handle = accept( tempFD, ( struct sockaddr *)&sock, &len);
if (setsockopt(ses_handle, SOL_SOCKET, SO_RCVTIMEO,
(char*)&tcptimeout, tcptimeoutLen) == -1)
{
perror("Set SO_RCVTIMEO: FAILED")
}
<more stuff here>
}
}
Well, I've had a failure report come my way which pretty much indicates
the following: the setsockopt() after the accept() returned a failure
which indicated that the File Descriptor was invalid.
Question: under what circumstances would the io-pkt stack purge it's
current file descriptor list (if ever)?
Maurice Gibbs
Software Designer
CommTest WaveReady BU
JDS Uniphase Corp.
613.843.2326
|
|
|