[Live-devel] How can I get the senders source port when receiving rtp streams with liveMedia?

Ross Finlayson finlayson at live555.com
Mon Feb 13 17:37:33 PST 2006


>I need to know the source port of a rtp stream I'm receiving with
>live555 Streaming Media.
>Is there an easy way to query this port?
>If yes how can I query it?

First, get the 'groupsock' object associated with the "RTPSource":
         Groupsock* gs = yourRTPSource->RTPgs();

Then, get its socket number:
         int socketNumber = gs->socketNum();

Then, get the source port:
         Port resultPort;
         if (!getSourcePort(env, socketNumber, resultPort) {
                 env << "Failed to get source port: "
                     << env.getResultMsg() << "\n";
         } else {
                 portNumBits sourcePortNum = resultPort.num():
                 // Note that this is in network order; call ntohs() 
to get host order
         }


	Ross Finlayson
	Live Networks, Inc. (LIVE555.COM)
	<http://www.live555.com/>



More information about the live-devel mailing list