title: Can writing to a UDP socket ever block?
body: <p>And if so, under what conditions? Or, phrased alternately, is it safe to run this code inside of twisted:</p>
  
  <pre><code>class StatsdClient(AbstractStatsdClient):
    def __init__(self, host, port):
      super(StatsdClient, self).__init__()
      self.addr = (host, port)
      self.server_hostname = socket.gethostname()
      self.udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  
    def incr(self, stat, amount=1):
      data = {"%s|c" % stat: amount}
      self._send(data)
  
    def _send(self, data):
      for stat, value in data.iteritems():
        self.udp_sock.sendto("servers.%s.%s:%s" % (self.server_hostname, stat, value), self.addr)
  </code></pre>