Beispiel #1
0
 def recv_into(self, buffer, nbytes = 0, flags = 0, raw = False):
     if not raw:
         if nbytes == 0:
             nbytes = len(buffer)
         data = self.recv(nbytes, flags)
         length = len(data)
         buffer[:length] = data
         return length
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #2
0
 def recv_into(self, buffer, nbytes=0, flags=0, raw=False):
     if not raw:
         if nbytes == 0:
             nbytes = len(buffer)
         data = self.recv(nbytes, flags)
         length = len(data)
         buffer[:length] = data
         return length
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #3
0
 def recv_into(self, buffer, nbytes=None, flags=0):
     self._checkClosed()
     if buffer and nbytes is None:
         nbytes = len(buffer)
     elif nbytes is None:
         nbytes = 1024
     if self._sslobj:
         if flags != 0:
             raise ValueError('non-zero flags not allowed in calls to recv_into() on %s' % self.__class__)
         return self.read(nbytes, buffer)
     return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #4
0
 def recv_into(self, buffer, nbytes=None, flags=0):
     if buffer and (nbytes is None):
         nbytes = len(buffer)
     elif nbytes is None:
         nbytes = 1024
     if self._sslobj:
         if flags != 0:
             raise ValueError("non-zero flags not allowed in calls to recv_into() on %s" % self.__class__)
         tmp_buffer = self.read(nbytes)
         v = len(tmp_buffer)
         buffer[:v] = tmp_buffer
         return v
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #5
0
 def recv_into(self, buffer, nbytes=None, flags=0):
     if buffer and (nbytes is None):
         nbytes = len(buffer)
     elif nbytes is None:
         nbytes = 1024
     if self._sslobj:
         if flags != 0:
             raise ValueError(
                 "non-zero flags not allowed in calls to recv_into() on %s"
                 % self.__class__)
         tmp_buffer = self.read(nbytes)
         v = len(tmp_buffer)
         buffer[:v] = tmp_buffer
         return v
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #6
0
 def recv_into(self, buffer, nbytes=None, flags=0):
     self._checkClosed()
     if buffer and (nbytes is None):
         nbytes = len(buffer)
     elif nbytes is None:
         nbytes = 1024
     if self._sslobj:
         if flags != 0:
             raise ValueError(
               "non-zero flags not allowed in calls to recv_into() on %s" %
               self.__class__)
         while True:
             try:
                 v = self.read(nbytes, buffer)
                 return v
             except SSLError as x:
                 if x.args[0] == SSL_ERROR_WANT_READ:
                     continue
                 else:
                     raise x
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #7
0
 def recv_into(self, buffer, nbytes=None, flags=0):
     self._checkClosed()
     if buffer and (nbytes is None):
         nbytes = len(buffer)
     elif nbytes is None:
         nbytes = 1024
     if self._sslobj:
         if flags != 0:
             raise ValueError(
                 "non-zero flags not allowed in calls to recv_into() on %s"
                 % self.__class__)
         while True:
             try:
                 v = self.read(nbytes, buffer)
                 return v
             except SSLError as x:
                 if x.args[0] == SSL_ERROR_WANT_READ:
                     continue
                 else:
                     raise x
     else:
         return socket.recv_into(self, buffer, nbytes, flags)
Beispiel #8
0
                raise ValueError(
                    "non-zero flags not allowed in calls to recv_into() on %s"
                    % self.__class__)
            while True:
                try:
                    tmp_buffer = self.read(nbytes)
                    v = len(tmp_buffer)
                    buffer[:v] = tmp_buffer
                    return v
                except SSLError, x:
                    if x.args[0] == SSL_ERROR_WANT_READ:
                        continue
                    else:
                        raise x
        else:
            return socket.recv_into(self, buffer, nbytes, flags)

    def recvfrom(self, addr, buflen=1024, flags=0):
        if self._sslobj:
            raise ValueError("recvfrom not allowed on instances of %s" %
                             self.__class__)
        else:
            return socket.recvfrom(self, addr, buflen, flags)

    def recvfrom_into(self, buffer, nbytes=None, flags=0):
        if self._sslobj:
            raise ValueError("recvfrom_into not allowed on instances of %s" %
                             self.__class__)
        else:
            return socket.recvfrom_into(self, buffer, nbytes, flags)
Beispiel #9
0
                raise ValueError(
                  "non-zero flags not allowed in calls to recv_into() on %s" %
                  self.__class__)
            while True:
                try:
                    tmp_buffer = self.read(nbytes)
                    v = len(tmp_buffer)
                    buffer[:v] = tmp_buffer
                    return v
                except SSLError, x:
                    if x.args[0] == SSL_ERROR_WANT_READ:
                        continue
                    else:
                        raise x
        else:
            return socket.recv_into(self, buffer, nbytes, flags)

    def recvfrom (self, addr, buflen=1024, flags=0):
        if self._sslobj:
            raise ValueError("recvfrom not allowed on instances of %s" %
                             self.__class__)
        else:
            return socket.recvfrom(self, addr, buflen, flags)

    def recvfrom_into (self, buffer, nbytes=None, flags=0):
        if self._sslobj:
            raise ValueError("recvfrom_into not allowed on instances of %s" %
                             self.__class__)
        else:
            return socket.recvfrom_into(self, buffer, nbytes, flags)