title: Receiving RTP packets after RTSP setup
body: <p>I'm trying to stream RTP packets from an IP camera using Python.  </p>
  
  <p>I am able to send the describe, setup &amp; play commands using RTSP protocol, however, I am unable to start streaming the actual videostream using RTP.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import socket 
  
  def printrec(recst):
    recs=recst.split('\r\n')
    for rec in recs:
      print rec
  
  dest="DESCRIBE rtsp://admin:12345@192.168.1.74 RTSP/1.0\r\nCSeq: 2\r\nUser-Agent: python\r\nAccept: application/sdp\r\n\r\n"
  
  setu="SETUP rtsp://admin:12345@192.168.1.74/trackID=1 RTSP/1.0\r\nCSeq: 3\r\nUser-Agent: python\r\nTransport: RTP/AVP;unicast;client_port=60784-60785\r\n\r\n"
  
  play="PLAY rtsp://admin:12345@192.168.1.74/ RTSP/1.0\r\nCSeq: 5\r\nUser-Agent: python\r\nSession: SESID\r\nRange: npt=0.000-\r\n\r\n"
  
  # .. here SESID will be substituted with the session id that SETUP returns us ..
  
  ip="192.168.1.74"
  s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((ip,554))
  
  s.send(dest)
  recst=s.recv(4096)
  printrec(recst)
  
  # etc. then the same for the strins "setu" and "play"
  
  ....
  </code></pre>
  
  <p>Setup replies me:</p>
  
  <pre><code>RTSP/1.0 200 OK
  CSeq: 3
  Session:       1117448817;timeout=60
  Transport: RTP/AVP;unicast;client_port=60784-60785;server_port=8214-8215;ssrc=40d35c30;mode="play"
  Date:  Mon, Jan 19 2015 11:10:08 GMT
  </code></pre>
  
  <p>So we have the client ports 60784 and 60785 and the server ports 8214 and 8215.</p>
  
  <p>Next, play replies me:</p>
  
  <pre><code>RTSP/1.0 200 OK 
  CSeq: 5
  Session:       1117448817
  RTP-Info: url=rtsp://admin:12345@192.168.1.74/trackID=1;seq=3539;    rtptime=16026930
  Date:  Mon, Jan 19 2015 11:10:08 GMT
  </code></pre>
  
  <p>Next, what am I supposed to do in order to start receiving RTP packets?
  Open an UDP socket as follow .. ?</p>
  
  <pre><code>sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
  sock.bind((ip, serverport))
  sock.recv(4096)
  </code></pre>
  
  <p>But I get nothing .. (it stalls)</p>
  
  <p>Excuse me my poor knowledge of sockets..!</p>