Пример #1
0
 def setsockopt(self, level, option, value):
     with rffi.scoped_str2charp(value) as buf:
         res = _c.socketsetsockopt(self.fd, level, option,
                                   rffi.cast(rffi.VOIDP, buf),
                                   len(value))
         if res < 0:
             raise self.error_handler()
Пример #2
0
 def setsockopt(self, level, option, value):
     with rffi.scoped_str2charp(value) as buf:
         res = _c.socketsetsockopt(self.fd, level, option,
                                   rffi.cast(rffi.VOIDP, buf),
                                   len(value))
         if res < 0:
             raise self.error_handler()
Пример #3
0
 def setsockopt_int(self, level, option, value):
     with lltype.scoped_alloc(rffi.INTP.TO, 1) as flag_p:
         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))
         if res < 0:
             raise self.error_handler()
Пример #4
0
 def setsockopt_int(self, level, option, value):
     with lltype.scoped_alloc(rffi.INTP.TO, 1) as flag_p:
         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))
         if res < 0:
             raise self.error_handler()