def send(self, data):
sock = socket.socket(*self.sock_args)<EOL>try:<EOL><INDENT>sock.connect(self.sock_addr)<EOL><DEDENT>except socket.error as exc:<EOL><INDENT>raise socket.error("<STR_LIT>" % (self.url.geturl(), exc))<EOL><DEDENT>try:<EOL><INDENT>sock.send(data)<EOL>while True:<EOL><INDENT>chunk = sock.recv(self.CHUNK_SIZE)<EOL>if chunk:<EOL><INDENT>yield chunk<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>sock.close()<EOL><DEDENT>
Open transport, send data, and yield response chunks.