Ejemplo n.º 1
0
def multiprocessing_send(space, handle, data):
    if data is None:
        raise OperationError(space.w_ValueError, 'data cannot be None')
    with rffi.scoped_nonmovingbuffer(data) as dataptr:
        # rsocket checks for writability of socket with wait_for_data, cpython does check
        res = send(handle, dataptr, len(data), 0)
        if res < 0:
            raise getWindowsError(space)
    return space.newint(res)
Ejemplo n.º 2
0
 def send_raw(self, dataptr, length, flags=0):
     """Send data from a CCHARP buffer."""
     res = -1
     timeout = self._select(True)
     if timeout == 1:
         raise SocketTimeout
     elif timeout == 0:
         res = _c.send(self.fd, dataptr, length, flags)
     if res < 0:
         raise self.error_handler()
     return res
Ejemplo n.º 3
0
 def send_raw(self, dataptr, length, flags=0):
     """Send data from a CCHARP buffer."""
     res = -1
     timeout = self._select(True)
     if timeout == 1:
         raise SocketTimeout
     elif timeout == 0:
         res = _c.send(self.fd, dataptr, length, flags)
     if res < 0:
         raise self.error_handler()
     return res
Ejemplo n.º 4
0
 def WRITE(self, data):
     from rpython.rlib._rsocket_rffi import send, geterrno
     length = send(self.fd, data, len(data), 0)
     if length < 0:
         raise WindowsError(geterrno(), "send")
     return length
Ejemplo n.º 5
0
 def WRITE(self, data):
     from rpython.rlib._rsocket_rffi import send, geterrno
     length = send(self.fd, data, len(data), 0)
     if length < 0:
         raise WindowsError(geterrno(), "send")
     return length