def nn_setsockopt(socket, level, option, value):
    """set a socket option

    socket - socket number
    level - option level
    option - option
    value - a readable byte buffer (not a Unicode string) containing the value
    returns - 0 on success or < 0 on error

    """
    try:
        return _nn_setsockopt(socket, level, option, ctypes.addressof(value),
                              len(value))
    except (__HOLE__, AttributeError):
        buf_value = ctypes.create_string_buffer(value)
        return _nn_setsockopt(socket, level, option,
                              ctypes.addressof(buf_value), len(value))
dataset/ETHPy150Open tonysimpson/nanomsg-python/_nanomsg_ctypes/__init__.py/nn_setsockopt