title: Video stream over UDP
body: <p>I'm currently trying to stream video over UDP from an RPi (running Raspbian) to my MBP Retina (Yosemite).</p>
  
  <p>I have a working script to stream over TCP, but I understand that UDP is the better option for video streaming, however I'm not really sure how to do it. Here is what I have so far:</p>
  
  <pre><code>import socket, picamera, time
  
  UDPsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  file = UDPsock.makefile('wb')
  
  class videostream():
      def __init__(self):
          print "Camera Class Initialised"
      def stream(self):
          with picamera.PiCamera() as camera:
              camera.resolution = (640, 480)
              camera.start_preview()
              time.sleep(2)
              camera.start_recording(file, format='h264')
              camera.wait_recording(60)
              camera.stop_recording()
  
  camera = videostream()
  stream = camera.stream()
  address = ("10.0.1.29", 8000)
  UDPsock.sendto(stream, address)
  </code></pre>
  
  <p>It gives me this error: <code>socket.error: [Errno 89] Destination address required</code> on the line: <code>camera.stop_recording()</code>. </p>
  
  <p>I'm fairly new to networking within Python so forgive any stupid mistakes.</p>