[Live-devel] Fwd: why am I getting "bad ports" in groupsock/GroupsockHelper.cpp:setupDatagramSocket()?

Ross Finlayson finlayson at live555.com
Mon Sep 26 21:24:46 PDT 2016


> Now, a better question is, what's magic about 6970

grep 6970 liveMedia/include/*.hh

There’s nothing ‘magic’ about port number 6970; however, it was the default starting port number for Apple's (formerly frequently used, but now defunct) "QuickTime Media Server", so I decided to make this the default starting port number for our RTSP server - in case people’s firewalls were set up to allow port numbers in a small range, starting with 6970.  

Our RTSP server implementation (actually, “OnDemandServerMediaSubsession”, for unicast clients) chooses a port number to use for each client session.  It does this by iterating over port numbers - beginning with the starting port number - until it finds one that is not in use (anywhere on the same host).  *** This is normal behavior; there is no ‘bug’ here. ***

You *could* change the starting port number by setting the “initialPortNum” parameter (to something other than its default value of 6970) in the call to the “ProxyServerMediaSession” constructor.  To do this, though, you would need to define your own subclass of “ProxyServerMediaSession”.

NOTE, HOWEVER, that this (‘per client session’) port number is COMPLETELY SEPARATE from the RTSP server’s base port number (e.g., 554 or 8554) - which is what the “-p” option specifies.  So it’s completely irrelevant to your real question:

> What I was trying to figure out was how get the proxy to just terminate if the specified port in the -p option was not available

This is real easy.  Call
	RTSPServer::createNew()
with the port number as (2nd) parameter.  If the port is unavailable, then this “createNew()” call will return NULL.

(See, for example, code in “proxyServer/live555ProxyServer.cpp”.)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list