I run the 'testH264VideoStreamer' app and view the video with an RTSP client (eg VLC). If I kill 'testH264VideoStreamer' while the client is connected and then try to run it again
straight away I get the following error:

Failed to create RTSP server: bind() error (port number: 8554): Address already in use

I ran netstat and found that the cause of this error is that the socket is in the TIME_WAIT
state. You need to wait until the TIME_WAIT timeout period elapses.
I found a way around this by editing the setupStreamSocket() function to set the SO_LINGER option with a timeout of 0 on the socket to force the server to abort the connection. Would that be a useful change to the code (maybe with a linger timeout > 0 )
or would it cause other side effects?

I'm not sure.  This web page
        http://developerweb.net/viewtopic.php?id=2982
suggests that SO_LINGER is not very portable, and might not always do what you want. (Other references (e.g., Stevens' book) also notes the (albeit remote) possibility of data corruption if you were to restart a server before the TIME_WAIT period ends.) So I'd be reluctant to add this to the code just to satisfy people's impatience. Instead, just wait a few seconds, and you'll be able to restart your server.
--

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to