OSC2.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:pyOSC3 作者: Qirky 项目源码 文件源码
def setOSCTarget(self, address, prefix=None, filters=None):
        """Add (i.e. subscribe) a new OSCTarget, or change the prefix for an existing OSCTarget.
          the 'address' argument can be a ((host, port) tuple) : The target server address & UDP-port
            or a 'host' (string) : The host will be looked-up 
          - prefix (string): The OSC-address prefix prepended to the address of each OSCMessage
          sent to this OSCTarget (optional)
        """
        if type(address) in types.StringTypes:
            address = self._searchHostAddr(address)

        elif (type(address) == types.TupleType):
            (host, port) = address[:2]
            try:
                host = socket.gethostbyname(host)
            except:
                pass

            address = (host, port)
        else:
            raise TypeError("'address' argument must be a (host, port) tuple or a 'host' string")

        self._setTarget(address, prefix, filters)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号