def setsockopt_int(self, level, option, value): flag_p = lltype.malloc(rffi.INTP.TO, 1, flavor='raw') try: flag_p[0] = rffi.cast(rffi.INT, value) res = _c.socketsetsockopt(self.fd, level, option, rffi.cast(rffi.VOIDP, flag_p), rffi.sizeof(rffi.INT)) finally: lltype.free(flag_p, flavor='raw') if res < 0: raise self.error_handler()
def setsockopt(self, level, option, value): res = _c.socketsetsockopt(self.fd, level, option, value, len(value)) if res < 0: raise self.error_handler()