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