Exemple #1
0
    def accept(self, **kws):
        """Accept a connection. The socket must be bound to an address and
        listening for connections. The return value is a pair (conn, address)
        where conn is a new socket object usable to send and receive data on the
        connection, and address is the address bound to the socket on the other
        end of the connection.

        Example:
        {{{
        conn, address = yield mysock.accept()
        }}}
        """
        return yield_(Accept(self, timeout=self._timeout, **kws))
Exemple #2
0
 def sendfile(self, file_handle, offset=None, length=None, blocksize=4096, **kws):
     return yield_(SendFile(file_handle, self, offset, length, blocksize, **kws))
Exemple #3
0
 def connect(self, address, **kws):
     """Connect to a remote socket at _address_. """
     return yield_(Connect(self, address, timeout=self._timeout, **kws))
Exemple #4
0
 def sendall(self, data, **kws):
     """Send data to the socket. The socket must be connected to a remote
     socket. All the data is guaranteed to be sent."""
     return yield_(SendAll(self, data, timeout=self._timeout, **kws))
Exemple #5
0
 def send(self, data, **kws):
     """Send data to the socket. The socket must be connected to a remote
     socket. Ammount sent may be less than the data provided."""
     return yield_(Send(self, data, timeout=self._timeout, **kws))
Exemple #6
0
 def recv(self, bufsize, **kws):
     """Receive data from the socket. The return value is a string
     representing the data received. The amount of data may be less than the
     ammount specified by _bufsize_. """
     return yield_(Recv(self, bufsize, timeout=self._timeout, **kws))