[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/jeffThompson/python2-osc/python2/pythonosc/udp_client.py [Back]  [Original]

"""Client to send OSC datagrams to an OSC server via UDP."""

import socket


class UDPClient(object):
  """OSC client to send OscMessages or OscBundles via UDP."""

  def __init__(self, address, port):
    """Initialize the client.

    As this is UDP it will not actually make any attempt to connect to the
    given server at ip:port until the send() method is called.
    """
    self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    self._sock.setblocking(0)
    self._address = address
    self._port = port

  def send(self, content):
    """Sends an OscBundle or OscMessage to the server."""
    self._sock.sendto(content.dgram, (self._address, self._port))

Web Proxy Viewer  |  New URL  |  Original Page