Hi Ross,<br><br>So, here is what I found, "WSAGetLastError()" returns WSAENOTSOCK when turnOffBackgroundReadHandling was not called as many times as turnOnBackgroundReadHandling is called.<br>So, my problem was happening only on RTP over TCP, as turnOnBackgroundReadHandling is called <br>
twice for RTCP handling and turnOffBackgroundReadHandling was called only once when clientsession is deleted.<br><br>in OnDemandMediaSubsession.cpp, startPlaying method (line 425),<br><br>RTCPInstance::createNew(..) will call turnOnBackgroundReadHandling as a part of RTCPInstance construction.<br>
and then, if it's RTCP over TCP, addStreamSocket is called, which will call turnOnBackgroundReadHandling again (for the same socket)<br><br>if (dests->isTCP) {<br>.. fRTCPInstance->addStreamSocket(..)<br> <br>
in RTCP.cpp<br><br>void RTCPInstance::addStreamSocket(int sockNum,<br>                                 unsigned char streamChannelId) {<br> // Add the RTCP-over-TCP interface:<br> fRTCPInterface.setStreamSocket(sockNum, streamChannelId);<br><br>
// Turn on background reading for this socket (in case it's not on already):<br> TaskScheduler::BackgroundHandlerProc* handler<br> = (TaskScheduler::BackgroundHandlerProc*)&incomingReportHandler;<br> fRTCPInterface.startNetworkReading(handler);<br>
}<br><br>So, my quickest fix was to put the following line<br><br>void RTCPInstance::addStreamSocket(int sockNum,<br>                                 unsigned char streamChannelId) <br>{<br><b> <span style="background-color: rgb(255, 255, 153);">// Turn off the default background read handling created along with RTCPInstance</span><br style="background-color: rgb(255, 255, 153);">
<span style="background-color: rgb(255, 255, 153);"> fRTCPInterface.stopNetworkReading();</span><br>                                         </b><br> // Add the RTCP-over-TCP interface:<br> fRTCPInterface.setStreamSocket(sockNum, streamChannelId);<br>
<br> // Turn on background reading for this socket<br> TaskScheduler::BackgroundHandlerProc* handler<br> = (TaskScheduler::BackgroundHandlerProc*)&incomingReportHandler;<br> fRTCPInterface.startNetworkReading(handler);<br>
}<br><br>I'm not 100% sure why you have to call "turnOnBackgroundReadHandling" twice for RTP over TCP, but it seems like "turnOnBackgroundReadHandling" should be called after "fRTCPInterface.setStreamSocket(sockNum, streamChannelId)" to handle RTCP over TCP correctly.<br>
<br>--> Also I was just wondering, isn't fRTCPInterface supposed to be fRTPInterface, since it is actually an instance of RTPInterface,<br><br>I know that I don't fully understand live555 code at the moment, so, if what I explained above does not make any sense to you then please let me know,<br>
<br>Best Regards,<br> <br>Ken Seo<br><br><br>On Wed, Apr 30, 2008 at 9:01 PM, Ross Finlayson <<a href="mailto:finlayson@live555.com">finlayson@live555.com</a>> wrote:<br>> >Windows error 10038 is "WSAENOTSOCK", and typically happens when an<br>
> >application is trying to do some socket operation on non-socket or the<br>> >socket that has already been closed, (at least that's my<br>> >understanding..)<br>> >I was getting this error, from the line in the BasicTaskScheduler.cpp<br>
> >(build 2008-04-03)<br>> ><br>> > int err = WSAGetLastError(); // err = 10038<br>> ><br>> >And it only happens when RTSP server tries to delete clientSession due<br>> >to livenessTimeout, (it doesn't happen when session gets closed by<br>
> >TEARDOWN request).<br>> <br>> That's odd, because - in each case - the "RTSPClientSession"<br>> destructor will get called, and this should be removing its socket<br>> from the set of active sockets, via the call to<br>
> envir().taskScheduler().turnOffBackgroundReadHandling(fClientSocket);<br>> on line 271 of "RTSPServer.cpp".<br>> <br>> So I wonder why this isn't working for you.<br>> <br>> Please let us know if you can find out anything more about this issue.<br>
> --<br>> <br>> <br>> <br>> Ross Finlayson<br>> Live Networks, Inc.<br>> <a href="http://www.live555.com/">http://www.live555.com/</a><br>> _______________________________________________<br>
> live-devel mailing list<br>> <a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>> <a href="http://lists.live555.com/mailman/listinfo/live-devel">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
> <br><br>