[Live-devel] openRTSP exit() in BasicTaskScheduler::SingleStep() due to socket error 10038(WSAENOTSOCK)

Brain Lai brainlai at gmail.com
Fri Apr 25 04:00:29 PDT 2008


 Dear Sir:

>That's right - the change you're proposing makes no sense, because
>"readSet" should already have the correct socket numbers (and no
>others) set, because of the assignment (at the start of the
>"SingleStep()" function:
>	fd_set readSet = fReadSet; // make a copy for this select() call

After writing some more debug code to print fds in readSet before/after reset,
I found that the readSet before/after reset is logically the same but
different physically in order!!!

That's the problem.
I found this article describing this issue:
http://blogs.msdn.com/wndp/archive/2006/07/13/664737.aspx

The fReadSet is filled with mixed sockets of UDP/TCP and select() on
Windows XP returns WSAENOTSOCK for me!

I guess that's why they can be selected individually without problem.

BTW, not many PCs in my test environments(<10) but I have seen two PCs
had the problem.

PS: the debug code in BasicTaskScheduler::SingleStep() for reference.

{
  FILE *fp = fopen("c:\\live555.txt", "a");
  fprintf(fp, "[BasicTaskScheduler::SingleStep()] maximum fd %d, there
%d fds in fReadSet while %d ones in readSet\n", fMaxNumSockets - 1,
fReadSet.fd_count, readSet.fd_count);
  for(size_t i = 0; i < readSet.fd_count; i++)
    fprintf(fp, "[BasicTaskScheduler::SingleStep()] readSet has fd %d
while fReadSet has fd %d\n", readSet.fd_array[i],
fReadSet.fd_array[i]);
			
  int selectResult = select(fMaxNumSockets, &readSet, NULL, NULL,
&tv_timeToDelay);
  fprintf(fp, "[BasicTaskScheduler::SingleStep()] select(readSet via
copy) return %d with err %d\n", selectResult, selectResult < 0 ?
WSAGetLastError() : 0);
  fclose(fp);
}

{
  HandlerIterator iter(*fReadHandlers);
  HandlerDescriptor* handler;
  FD_ZERO(&readSet);
  while ((handler = iter.next()) != NULL)
    FD_SET((unsigned)handler->socketNum, &readSet);
		
  FILE *fp = fopen("c:\\live555.txt", "a");
  fprintf(fp, "[BasicTaskScheduler::SingleStep()] max fd %d, there %d
fds in reset fReadSet while %d ones in readSet\n", fMaxNumSockets - 1,
fReadSet.fd_count, readSet.fd_count);
  for(size_t i = 0; i < readSet.fd_count; i++)
    fprintf(fp, "[BasicTaskScheduler::SingleStep()] reset readSet has
fd %d while fReadSet has fd %d\n", readSet.fd_array[i],
fReadSet.fd_array[i]);

  fclose(fp);
}

BR.
Brain Lai
int selectResult = select(fMaxNumSockets, &readSet, NULL, NULL,
&tv_timeToDelay);
{
  FILE *fp = fopen("c:\\live555.txt", "a");
  fprintf(fp, "[BasicTaskScheduler::SingleStep()] select(readSet via
reset) return %d with err %d\n", selectResult, selectResult < 0 ?
WSAGetLastError() : 0);
  fclose(fp);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20080425/5a3ebc74/attachment-0001.html 


More information about the live-devel mailing list